perm filename PL[F,PMP] blob sn#008150 filedate 1972-09-03 generic text, type T, neo UTF8
00100	TITLE PL PREPARE A PC FILE FROM AN RPH WIRE LIST (TST) FILE
00200	
00300	↓P←17 ↓A1←1 ↓A2←2 ↓A3←3 ↓A4←4 ↓A5←5 ↓A6←6
00400	↓T←7 ↓C←12 ↓D←13 ↓E←14 ↓F←15 ↓DD←10 ↓SS←11 ↓FS←16
00500	
00600	↓NFSW←←1
00700	PRTSW←←1
00800	STRT:	CALLI
00900		INIT 1,10
01000		SIXBIT /DSK/
01100		DIB
01200		JRST 4,.
01300		MOVE P,[XWD -PDLEN,PDL-1]
01400		MOVEI C,LUP
01500		SETZM LUP
01600		FOR I←1,3 {SETZM LUP+I
01700	}
01800		MOVEI D,'TST'
01900		HRLM D,LUP+1
02000		OUTSTR [ASCIZ /INPUT /]
02100		PUSHJ P,FNAM
02200		LOOKUP 1,LUP
02300		JRST NOLUP
02400		INIT 2,IFE NFSW,{1;}10
02500		SIXBIT /DSK/
02600		XWD DOB,0
02700		JRST 4,.
02800	EC1:	SETZM ENT
02900		SETZM ENT+2
03000		SETZM ENT+3
03100		MOVEI C,IFE NFSW,{'TXT';}'PCC'
03200		HRLZM C,ENT+1
03300		MOVEI C,ENT
03400		OUTSTR [ASCIZ /OUTPUT /]
03500		PUSHJ P,FNAM
03600		ENTER 2,ENT
03700		JRST NOENT
03800		INBUF 1,2
03900		OUTBUF 2,2
04000		HRRZ C,JOBFF
04100		ADDI C,1
04200		TRZ C,1
04300		MOVEM C,FS
04400		EXTERN JOBFF,JOBREL
04500		SETZM CEPNUM#
04600		MOVEI C,=143
04700		MOVEI D,2
04800		CAMGE D,PINT2(C)
04900		SETZM PINT2(C)
05000		SOJGE C,.-2
05100		DEFINE CLR (Q,SIZ)
05200	{	SETZM Q
05300		MOVE C,[XWD Q,Q+1]
05400		BLT C,Q+SIZ}
05500		CLR (CEPINS,=144)
05600		CLR (HTYPS,777)
05700		CLR (TYPTYP,1777)
05800		CLR (TYPPNT,1777)
05900		CLR (VLIST,=128*=20-1)
06000		CLR (HLIST,=128*=20-1)
06100		CLR (HPOS,37)
06200		CLR (VPOS,37)
06300		MOVEI T,130
06400		MOVEM T,YPO#
06500		MOVEI T,150
06600		MOVEM T,XPO#
06700		SETZM PPPP
06800	JRST ST
     

00100	LUP:	BLOCK 4
00200	DIB:	BLOCK 3
00300	BW:	XWD 37,37000
00400	ENT:	BLOCK 4
00500	DOB:	BLOCK 3
00600	PDLEN←←100
00700	PDL:	BLOCK PDLEN
00800	CPLEN←←20
00900	CPDL:	BLOCK CPLEN
01000	IPLEN←←500
01100	IPDL:	BLOCK IPLEN
01200	DOLR:	BLOCK 6
01300	STAR:	BLOCK 6
01400	PERC:	BLOCK 6
01500	ALPH:	BLOCK 6
01600	PPPP:	0
01700	XOFF:	=118
01800	YOFF:	=100
01900	SIDE:	0
02000	CECNT:	0
02100	SLA:	BLOCK 24
02200	NEWP:	0
02300	NEWT:	BLOCK =500
02400	SNCNT:	0
02500	NCSAV:	0
02600	NNCSAV:	0
02700	
02800	PRT101:	JRST 4,.
02900	NINON:	0
03000	INON:	0
03100	OUTON:	0
03200	NST:	BLOCK =40
03300	
03400	NODPNT:	0
03500	A1S:	BLOCK 5
03600	A6S:	0
03700	
03800	
03900	DEFINE TYPES 
04000	{	TYP (0,0,0,14)
04100		TYP (SN74S00,1000000,10000000000000,14)
04200		TYP (SN74S10,1000000,10000000000000,14)
04300		TYP (SN74S04,1000000,10000000000000,14)
04400		TYP (SN74S20,1000000,10000000000000,14)
04500		TYP (SN74S140,1000000,10000000000000,14)
04600		TYP (SN74S133,10000000,1000000000000000,16)
04700		TYP (SN74151,10000000,1000000000000000,16)
04800		TYP (SN74153,10000000,1000000000000000,16)
04900		TYP (SN74175,10000000,1000000000000000,16)
04940		TYP(SN74S174,10000000,1000000000000000,16)
04980		TYP(SN74S157,10000000,1000000000000000,16)
05000		TYP (1503,10000000,1000000000000000,16);?
05100		TYP (3404,10000000,1000000000000000,16);?
05200		TYP (SN74S64,1000000,10000000000000,14)
05300		TYP (SN74S74,1000000,10000000000000,14)
05400		TYP (SN74H183,1000000,10000000000000,14)
05500		TYP (SN74S11,1000000,10000000000000,14)
05600	}
05700	DEFINE TYP (A,B,C,D)
05800	{	[ASCIZ /A/]}
05900	TYPTB1:	TYPES
06000	TYPNUM←←.-TYPTB1
06100	DEFINE TYP $(A,B,C,D)
06200	{	B$0}
06300	RADIX 2
06400	TYPTBG:	TYPES
06500	RADIX =8
06600	DEFINE TYP $ (A,B,C,D)
06700	{	C$0}
06800	RADIX 2
06900	TYPTBP:	TYPES
07000	RADIX =8
07100	DEFINE TYP $(A,B,C,D)
07200	{	XWD FOO$D,=D}
07300	FOO14←←0
07400	FOO16←←1
07500	FOO24←←2
07600	TYPTBN:	TYPES
07700		DEFINE TYP $(A,B,C,D)
07800	{	CTAB$D}
07900	TYPCTB:	TYPES
08000	TTAB1:	3
08100		3
08200		6
08300	TTAB2:	-7
08400		-7
08500		-=10
08600	TTAB3:	5
08700		5
08800		10
08900	TTAB4:	-3&177
09000		-3&177
09100		-6&177
09200	TTAB5:	7
09300		7
09400		=13
09500	TTAB6:	400016
09600		400020
09700		400000+=24
09800	TTAB7:	=15
09900		=17
10000		=25
10100	TTAB8:	37777
10200		177777
10300		XWD 77,-1
10400	TTAB9:	6
10500		6
10600		=12
10700	TTAB10:	6
10800		=8
10900		=12
11000	TTAB11:	XWD -6&177,3
11100		XWD -6&177,3
11200		XWD -=9&177,6
11300	TTAB12:	3,,3
11400		3,,3
11500		6,,6
11600	TTAB13:	-3&177,,-3&177
11700		-3&177,,-3&177
11800		-6&177,,-6&177
11900	
12000	CEPINS:	BLOCK =145
12100		0
12200	HTYPS:	BLOCK 1000
12300		XWD 377777,-1
12400	TYPTYP:	BLOCK 2000
12500	TYPPNT:	BLOCK 2000
12600	VLIST:	BLOCK =128*=20
12700	HLIST:	BLOCK =128*=20
12800	HPOS:	BLOCK 40
12900	VPOS:	BLOCK 40
13000	INFN:	BLOCK 40
13100	INFP:	BLOCK 40
13200	CTAB14:	FOR I←1,=13,2 {I
13300	}
13400		FOR I←=12,0,-2{I
13500	}
13600	CTAB16:	FOR I←1,=15,2{I
13700	}
13800		FOR I←=14,0,-2{I
13900	}
14000	
14100	DISTAB:	WHAT
14200		WHAT
14300		REASY
14400		NEASY
14500		XEASY
14600		XEASY
14700		XWD HOR,REG
14800		XWD HOR,REG
14900		XWD R10,REG
15000		XWD R10,REG;SPINC
15100		DO12
15200		DO13
15300	REPEAT 4,{XWD VER,REG};14-17
15400	REPEAT 10,{XWD VER,REG};20-27
15500	REPEAT 10,{WHAT};30-37
15600	REPEAT 10,{XWD HOR,REG};40-47
15700	REPEAT 10,{XWD LNG,REG};50-57
15800	REPEAT 10,{XWD LNG,REG};60-67
15900	REPEAT 10,{WHAT};70-77
16000	REPEAT 10,{XWD HOR,REG};100-107
16100	REPEAT 20,{XWD LNG,REG};110-127
16200	
16300	
16400	WHAT:	JRST 4,.
16500	DEFINE PO (A,B)
16600	{	MOVEI T,"A"+B⊗7
16700		PUSHJ P,POUT}
16800	DEFINE POO (A,B)
16900	{	MOVEI T,A+B⊗7
17000		PUSHJ P,POUT}
17100		DEFINE PCRL
17200	{	MOVEI T,24
17300		PUSHJ P,PPOUT}
17400	HMTB:	"("
17500		"("+200
17600		"("+400
17700		"("+600
17800		"["+000
17900		"["+200
18000		"["+400
18100		"["+600
18200		")"+000
18300		")"+200
18400		")"+400
18500		")"+600
18600		"]"+000
18700		"]"+200
18800		"]"+400
18900		"]"+600
19000	VMTB:	134
19100		334
19200		534
19300		734
19400		16
19500		216
19600		416
19700		616
19800		"/"
19900		200+"/"
20000		400+"/"
20100		600+"/"
20200		17
20300		217
20400		417
20500		617
20600	
20700	PCTAB:	FOR I←2,=26,3
20800	{	BYTE (12)I,I-1,I-2
20900	}
21000	
21100	FNARP←←=11
21200	FON←←-=202
21300	FNORP←←=20
21400	PINT1:	FOR @$ I E <ABCD>
21500	{	FOR @% J E <ABCDEFHJKLMNPRSTUV>
21600	{	XWD FON/2,'I$%J%2'
21700		XWD FON/2+1,'I$%J%1'
21800		FON←←FON+5
21900	}
22000	FON←←FON+FNORP
22100	FNERT←←FNORP
22200	FNORP←←FNARP
22300	FNARP←←FNERT
22400	}
22500		FOR @$ I IN (A,B,C,D)
22600	{	FOR @% J IN (B1,F1,C1,R1,U1)
22700	{	DEFINE .$I$%J {1}
22800	}}
22900		FOR @$ I IN (AU2,BB2,CU2,DB2)
23000	{	DEFINE .$I {1}
23100	}
23200		FOR @$ I IN (AV1,AV2,BA1,BA2,CV1,CV2,DA1,DA2)
23300	{	DEFINE .$I {2}
23400	}
23500	PINT2:	FOR @$ I E <ABCD>
23600	{	FOR @% J E <ABCDEFHJKLMNPRSTUV>
23700	{	IFDEF .$I$%J%2,<.$I$%J%2;>0
23800		IFDEF .$I$%J%1,<.$I$%J%1;>0
23900	}}
24000	
     

00100	FNAM:	OUTSTR [ASCIZ/FILE = /]
00200		MOVEI D,
00300	FLOP1:	INCHWL E
00400		SUBI E,40
00500		CAIL E,100
00600		SUBI E,40
00700		CAIG E,17
00800		JRST FDON
00900		LSH D,6
01000		OR D,E
01100		JRST FLOP1
01200	FDON:	TLNE D,770000
01300		JRST .+4
01400		LSH D,6
01500		TLNN D,770000
01600		JRST .-2
01700		MOVEM D,(C)
01800		ADDI E,40
01900		CAIN E,15
02000		INCHWL E
02100	CPOPJ:	POPJ P,
02200	DEFINE ACCS
02300	{A←A1 B←A2 G←A3 H←A4 J←A5 J1←A6 T1←DD T2←SS}
02400	BEGIN SUBS
02500	ACCS
02600	↑MATCH:	MOVE D,TYPTB1(C)
02700		CAME A,(D)
02800		JRST NOMAT
02900		TRNN A,376
03000		POPJ P,
03100		CAME B,1(D)
03200		JRST NOMAT
03300		POPJ P,
03400	NOMAT:	AOS (P)
03500		SKIPE (D)
03600		AOS (P)
03700		POPJ P,
03800	
03900	↑WRD:	SOSG DIB+2
04000		INPUT 1,
04100		ILDB B,DIB+1
04200		POPJ P,
04300	
04400	
04500	↑HGFIND:	HRLZS A		;GET HELLIWELLS GATE # IN LEFT
04600		MOVEI D,777	;START AT END OF TABLE
04700	HGLOP1:	CAML A,HTYPS(D)	;SEARCH BACK UNTIL TABLE IS LESS THAN WHAT WE HAVE
04800		JRST HFND1	;OK, GO THERE
04900		SUBI D,10
05000		JRST HGLOP1
05100	HFND1:	HLLZ E,HTYPS(D)	;GET TABLE ENTRY
05200		CAME E,A	;SEARCH FORWARD FOR EQUAL ENTRY
05300		AOJA D,HFND1
05400		POPJ P,
05500	
05600	↑GETCOR:	PUSH P,FS
05700		MOVE FS,JOBREL
05800		ADDI FS,2000
05900		CALLI FS,11
06000		JRST NOCOR
06100		POP P,FS
06200		POPJ P,
06300	↑GETFST:	EXCH F,FS
06400		ADD FS,F
06500		CAML FS,JOBREL
06600		PUSHJ P,GETCOR
06700	↑CCLR:	SETZM (F)
06800		PUSH P,D
06900		MOVS D,F
07000		HRRI D,1(F)
07100		BLT D,-1(FS)
07200		POP P,D
07300		POPJ P,
07400	
07500		DEFINE PRTC (A)
07600	{	MOVEI T1,A
07700		PUSHJ P,PRT101}
07800		DEFINE PRTCRL
07900	{	PRTC (15)
08000		PRTC (12)}
08100	
08200	  DEFINE PRTR $(ARG)
08300	{PRT$ARG: JUMPE T,PRTZER
08400		IDIVI T,ARG
08500		JUMPE T,.+4
08600		HRLM T1,(P)
08700		PUSHJ P,PRT$ARG
08800		HLRZ T1,(P)
08900		ADDI T1,60
09000	PRT$ARG$1: SOSG DOB+2
09100		OUTPUT 2,
09200		IDPB T1,DOB+1
09300		POPJ P,}
09400	
09500	PRTSIX:	JUMPE T,CPOPJ
09600		MOVEI T1,
09700		ROTC T,6
09800		JUMPE T1,PRTSIX
09900		ADDI T1,40
10000		PUSHJ P,PRT101
10100		JRST PRTSIX
10200	PRTASC:	HRLI T,440700
10300		ILDB T1,T
10400		JUMPE T1,CPOPJ
10500		PUSHJ P,PRT101
10600		JRST PRTASC+1
10700	PRTZER:	PRTC("0")
10800		POPJ P,
10900	↑NOENT:	OUTSTR [ASCIZ /CAN'T ENTER FILE
11000	/]
11100		JRST EC1
11200	↑NOLUP:	OUTSTR [ASCIZ /CAN'T FIND INPUT FILE
11300	/]
11400		JRST STRT
11500	↑NOCOR:	OUTSTR [ASCIZ /CAN'T GET ENOUGH CORE
11600	TYPE ANY KEY TO TRY AGAIN
11700	/]
11800		INCHRW
11900		JRST GETCOR+1
12000	
12100	
12200	↑WOUT:	SOSG DOB+2
12300		OUTPUT 2,
12400		IDPB T,DOB+1
12500		POPJ P,
12600	
12700	
12800	DEFINE MBMAKE (SIZ,NUM)
12900	{	IDIVI T1,=NUM
13000		IMULI T2,=SIZ
13100		DPB T2,[POINT 6,T1,5]
13200		TLO T1,=SIZ⊗6
13300		POPJ P,}
13400	↑MB12:	MBMAKE(12,3)
13500	↑MB1:	MBMAKE(1,36)
13600	
13700	↑FNUM:	LDB C,[POINT 5,SS,12]
13800		LDB G,[POINT 5,DD,12]
13900		SUB C,G
14000		MOVMS C
14100		LDB D,[POINT 5,SS,17]
14200		LDB E,[POINT 5,DD,17]
14300		SUB D,E
14400		MOVMS D
14500		JUMPN C,PNT1
14600		JUMPE D,PNT1
14700		LDB F,[POINT 5,SS,17]
14800		CAML E,F
14900		EXCH E,F
15000		MOVEI D,
15100		LSH G,5
15200		OR E,G
15300		OR F,G
15400		LSH G,-5
15500		ADDI E,1
15600		SKIPE TYPTYP(E)
15700		ADDI D,1
15800		CAME E,F
15900		JRST .-4
16000	PNT1:	MOVE E,SS
16100		ANDI E,77
16200		MOVE F,DD
16300		ANDI F,77
16400		CAMGE E,F
16500		EXCH E,F
16600		SUB E,F
16700		ANDI F,1
16800		CAILE E,3
16900		MOVEI E,3
17000		CAILE D,2
17100		MOVEI D,2
17200		CAILE C,2
17300		MOVEI C,2
17400		LSH E,1
17500		OR F,E
17600		LSH D,3
17700		OR F,D
17800		LSH C,5
17900		OR F,C
18000		POPJ P,
18100	
18200	IFN NFSW,{
18300	↑POSOUT:MOVN T,B	;GET Y
18400		ADD T,YOFF
18500		IMULI T,=20
18600		MOVN T1,A	;GET X
18700		ADD T1,XOFF
18800		IMULI T1,=20
18900		HRL T,T1
19000		JRST WOUT}
19100	
19200	
19300	↑MARK:	PUSH P,T1
19400		PUSH P,T2
19500		MOVE J1,T1	;FORM ENTRY
19600		HRL J1,T2	;...
19700		ANDI T1,37177
19800		TRNN T1,100
19900		TRO T1,200
20000		ANDI T2,37177
20100		TRNN T2,100
20200		TRO T2,200
20300		CAMG T1,T2	;SMALLER IN LEFT HALF
20400		MOVSS J1	;...
20500		MOVEI F,2	;GET 2-WORD BLOCK
20600		PUSHJ P,GETFST	;...
20700		MOVE T1,(J)	;LINK IT IN
20800		HRRZM T1,(F)	;...
20900		HRRM F,(J)	;...
21000		MOVEM J1,1(F)	;DEPOSIT ENTRY
21100		POP P,T2
21200		POP P,T1
21300		POPJ P,
21400	DPMARK:	MOVE T1,TYPPNT(J)	;GET TABLE ENTRY
21500		ADDI T1,3(J1)	;ADD PIN # & GET TO ENTRY
21600		MOVE T2,(T1)	;GET ENTRY FOR PIN
21700		MOVEM T1,DT1SAV#;SAVE TABLE POINTER
21800		PUSH P,J1	;SAVE J1
21900		TRNN H,37000	;IS NEW ENTRY THE "SAME DIP" TYPE?
22000		JRST DTY	;YES
22100		PUSH P,J	;NO
22200		LDB J1,[POINT 5,H,26];GET ROW OF NEW ENTRY
22300		ANDI J,37	;GET ROW OF THIS DIP
22400		CAML J,J1	;WHICH ROW LARGER?
22500		JRST DUP2	;NEW ENTRY SMALLER, GOING UP
22600		POP P,J		;NEW ONE LARGER, GOING DOWN
22700	DDN1:	TRNN T2,-1	;IS THERE AN OLD ENTRY?
22800		JRST DDN3	;NO
22900		HRRZS T2	;YES, GET IT
23000		PUSHJ P,DDO	;DO THE GOOD THINGS
23100		MOVE T1,DT1SAV	;GET POINTER TO TABLE
23200		HRRM T2,(T1)	;DEPOSIT CORRECT ENTRY
23300		POP P,J1
23400		POPJ P,
23500	DTY:	TRNN H,100	;ABOVE OR BELOW?
23600		JRST DDN1	;BELOW
23700		JRST DUP1	;ABOVE
23800	DUP2:	POP P,J
23900	DUP1:	TLNN T2,-1	;IS THERE AN OLD ENTRY?
24000		JRST DUP3	;NO
24100		HLRZS T2	;YES, GET IT
24200		PUSHJ P,DDO	;DO THE THINGS
24300		MOVE T1,DT1SAV	;GET POINTER TO TABLE
24400	DUP3:	HRLM H,(T1)	;DEPOSIT CORRECT ENTRY
24500		POP P,J1
24600		POPJ P,
24700	DDN3:	HRRM H,(T1)
24800		POP P,J1
24900		POPJ P,
25000	DDO:	PUSH P,H
25100		PUSH P,T2
25200		ANDI H,37177
25300		ANDI T2,37177
25400		TRNN H,100
25500		TRO H,200
25600		TRNN T2,100
25700		TRO T2,200	;STANDARDIZE ENTRIES
25800		TRNN H,37000
25900		DPB J,[POINT 5,H,26]
26000		TRNN T2,37000
26100		DPB J,[POINT 5,T2,26]
26200		CAML T2,H	;GET SMALLER ONE IN T2
26300		JRST .+4
26400		OR T2,(P)
26500		OR H,-1(P)
26600		JRST .+4
26700		OR T2,(P)
26800		OR H,-1(P)
26900		EXCH H,T2
27000		POP P,T1
27100		POP P,T1
27200		MOVE T1,H	;PUT OTHER ENTRY IN T1
27300		PUSH P,J
27400		LSH J,2		;GET COLUMN
27500		ANDI J,7600
27600		OR J,-2(P)	;OR IN PIN #
27700		ADDI J,VLIST	;GET POINTER TO VLIST ENTRY
27800		PUSHJ P,MARK	;PUT IN THE SEGMENT
27900		MOVE J,(P)	;GET BACK J
28000		ANDI J,37	;GET ROW OF THIS DIP
28100		LDB J1,[POINT 5,T2,26];GET DIP OF THIS ENTRY
28200		CAMN J,J1	;SAME?
28300		TRZ T2,37000	;YES, MAKE IT 0
28400		LDB J1,[POINT 5,H,26];GET DIP TYPE OF OTHER ONE
28500		CAMN J,J1	;SAME?
28600		TRZ H,37000	;YES, MAKE 0
28700		POP P,J
28800		POPJ P,
28900	↑MPIN:
29000		MOVE A,J1	;GET PIN #
29100		TRZ A,1
29200		ADD A,E	;ADD X OF DIP
29300		HLRZ T,TYPTBN(G);GET SIZE #
29400		MOVE B,TTAB1(T)	;GET VERT DISTANCE TO PIN FROM CENTER
29500		TRNE J1,1	;ODDD OR EVEN PIN #?
29600		MOVNS B	;ODD
29700		ADD B,F	;ADD IN Y OF DIP
29800		POPJ P,
29900	↑OUTREG:PUSH P,J
30000		PUSH P,J1
30100		PUSHJ P,MPIN	;GET X,Y (A,B) OF DIP PIN
30200		TRNN J,-1	;ANY DOWN ENTRY?
30300		JRST OND	;NO
30400		HLRZ T,TYPTBN(G);GET SIZE #
30500		TRNN J1,1	;ODD OR EVEN PIN #?
30600		JRST OED	;EVEN
30700		PUSHJ P,ODWN	;ODD, DO A DOWN
30800		SKIPA
30900	OED:	PUSHJ P,EDWN	;EVEN, DO A DOWN
31000		MOVE T1,-1(P)	;GET EXCURSION
31100		ANDI T1,37177
31200		TRNE T1,37000	;SAME DIP?
31300		JRST DWM1	;NO
31400	IFN NFSW,{JRST 4,.}
31500	DR1:	MOVE T1,-1(P)
31600	DR12:	MOVE J,-1(P)
31700	OND:	TLNN J,-1
31800		JRST OEDON
31900		MOVE J1,(P)
32000		HLRZ T,TYPTBN(G)
32100		TRNN J1,1	;ODD OR EVEN PIN?
32200		JRST OEU	;EVEN
32300		PUSHJ P,OUP	;ODD, DO AN UP
32400		SKIPA
32500	OEU:	PUSHJ P,EUP	;EVEN, DO AN UP
32600		MOVS T1,-1(P)
32700		TRNE T1,37000	;SAME DIP?
32800		JRST DWM2	;NO
32900	IFN NFSW,{JRST 4,.}
33000	DR2:	MOVS T1,-1(P)
33100	OEDON:	POP P,J1
33200		POP P,J
33300		POPJ P,
33400	II1:	0
33500		TRNN T1,100
33600		JRST @II1
33700		TRZ T1,177
33800		LDB T,[POINT 5,C,35]
33900		OR T1,INFN(T)
34000		AOS II1
34100		AOS II1
34200		JRST @II1
34300	II2:	0
34400		TRNE T1,100
34500		JRST @II2
34600		TRZ T1,177
34700		LDB T,[POINT 5,C,35]
34800		OR T1,INFP(T)
34900		JRST @II2
35000	DWM:	PUSH P,C
35100		LDB C,[POINT 5,T1,26];GET COURSE ROW
35200		MOVE T,C
35300		TRCN T1,77	;IS IT INFINITY?
35400		JSR II1
35500		TRCN T1,77
35600		JSR II2
35700		TLO T1,-1
35800		TRNE T1,100
35900		TROA T1,777700
36000		ANDI T1,177
36100		ADD T1,HPOS(T)
36200		POP P,C
36300		PUSH P,A
36400		PUSH P,B
36500		MOVE B,T1
36600		MOVE A,SAVX
36700		PUSHJ P,POSOUT
36800		POP P,B
36900		POP P,A
37000		POPJ P,
37100	DWM1:	PUSHJ P,DWM
37200		JRST DR1
37300	DWM2:	PUSHJ P,DWM
37400		JRST DR2
37500	IFN NFSW,{
37600	ODWN:	MOVE T2,UDT1(T)
37700		JRST UDD
37800	EDWN:	MOVE T2,UDT2(T)
37900		JRST UDD
38000	OUP:	MOVE T2,UDT3(T)
38100		JRST UDD
38200	EUP:	MOVE T2,UDT4(T)
38300	UDD:	PUSH P,A
38400		PUSH P,B
38500	UDL:	MOVE T,[400000,,400000]
38600		PUSHJ P,WOUT
38700		PUSHJ P,POSOUT
38800		SKIPN (T2)
38900		SKIPE 1(T2)
39000		JRST .+2
39100		JRST UDO
39200		ADD A,(T2)
39300		ADD B,1(T2)
39400		PUSHJ P,POSOUT
39500		ADDI T2,2
39600		JRST UDL
39700	UDO:	MOVEM A,SAVX#
39800		POP P,B
39900		POP P,A
40000		POPJ P,
40100	}
40200	IFN NFSW,{
40300	 FOR @$ I←1,4
40400	{UDT$I:	UDQ$I
40500		UDQ$I
40600		UDB$I
40700	}
40800	UDQ1:	0
40900	1
41000	1
41100	4
41200	0
41300	0
41400	UDB1:	0
41500	1
41600	1
41700	=10
41800	UDB2:
41900	UDQ2:	0
42000	0
42100	UDB3:
42200	UDQ3:	0
42300	-1
42400	1
42500	-2
42600	0
42700	0
42800	UDQ4:	0
42900	-1
43000	-1
43100	-4
43200	0
43300	-2
43400	1
43500	-2
43600	0
43700	0
43800	UDB4:	0
43900	-1
44000	-1
44100	-=10
44200	0
44300	-2
44400	1
44500	-2
44600	0
44700	0
44800	
44900	}
45000	FPFND:	HRRZ H,(F)	;GET FIRST ENTRY
45100		JUMPE H,CPOPJ	;NONE
45200		MOVEI J1,
45300		DPB C,[POINT 5,J1,26];GET DIP ROW
45400	FRP2:	SKIPL J,1(H)	;GET ENTRY
45500		JRST FRP3	;NOT RIGHT TYPE
45600		XOR J,J1	;IS IT FOR THIS DIP?
45700		TRNN J,37000	;?
45800		JRST CPOPJ1	;YES
45900	FRP3:	HRRZ H,(H)	;GET NEXT
46000		JUMPN H,FRP2
46100		POPJ P,
46200	↑FREEUP:LDB F,[POINT 5,C,30];GET DIP COL.
46300		LSH F,7
46400		OR F,E		;OR IN PIN #
46500		ADDI F,VLIST	;TABLE POINTER
46600		MOVE B,TYPTYP(C);GET DIP TYPE
46700		HLRZ B,TYPTBN(B);GET SIZE #
46800		MOVEI G,1
46900		LSH G,1(E)
47000		TDNE D,G	;IS NEXT PIN FREE?
47100		JRST FRP1	;YES
47200		PUSHJ P,FPFND	;FIND APPROP. ENTRY
47300		POPJ P,		;NONE
47400		MOVE J,1(H)	;GET ENTRY
47500		TRNN J,40	;LONG ENTRY?
47600		POPJ P,		;NO, LEAVE
47700		TDZ J,[777,,777];CLEAR OLD PART
47800		OR J,TTAB11(B)	;PUT IN NEW ENTRY
47900		MOVEM J,1(H)	;DEPOSIT
48000		POPJ P,
48100	FRP1:	PUSHJ P,FPFND	;FIND APPROP ENTRY
48200		POPJ P,		;NONE
48300		TRNN E,1	;EVEN OR ODD PIN?
48400		JRST FRP4	;EVEN
48500		MOVE J,[XWD 400000,400000]
48600		MOVEM J,1(H)	;DEPOSIT NULL ENTRY
48700		POPJ P,
48800	FRP4:	MOVE J,1(H)	;GET OLD ENTRY
48900		TDZ J,[777,,777];CLEAR OLD PART
49000		OR J,TTAB12(B)	;PUT IN FIRST ENTRY
49100		MOVEM J,1(H)
49200		MOVEI F,2
49300		PUSHJ P,GETFST	;GET A 2-WORD BLOCK
49400		TDZ J,[777,,777]
49500		OR J,TTAB13(B)	;GET OTHER ENTRY
49600		MOVEM J,1(F)
49700		HRRZ J,(H)	;LINK IN NEW ENTRY
49800		HRRM F,(H)	;...
49900		MOVEM J,(F)	;...
50000		POPJ P,
50100	
50200	↑FEDREM:SKIPGE T,1(D)
50300		POPJ P,
50400		TDNE T,[240000,,640000]
50500		POPJ P,
50600		TRZE T,100000
50700		TLZN T,100000
50800		POPJ P,
50900		AND T,[37177,,37177]
51000		HLRZ E,T
51100		TRNN T,100
51200		TRO T,200
51300		TRNN E,100
51400		TRO E,200
51500	FDL1:	ADDI E,1
51600		CAIL E,(T)
51700		JRST FRDON
51800		MOVE A,E
51900		LSH A,-2
52000		DPB E,[POINT 7,A,35]
52100		ADDI A,VLIST
52200		PUSHJ P,ISOKA
52300		POPJ P,
52400		JRST FDL1
52500	FRDON:	MOVE T,[100000,,100000]
52600		ANDCAM T,1(D)
52700		MOVEI T,400000
52800		ORM T,1(D)
52900		POPJ P,
53000	ISOKA:	HRRZ A,(A)
53100		JUMPE A,CPOPJ1
53200		HLRZ F,1(A)
53300		ANDI F,37177
53400		TRNN F,100
53500		TRO F,200
53600		CAMGE J,F
53700		JRST ISOKA
53800		HRRZ F,1(A)
53900		ANDI F,37177
54000		TRNN F,100
54100		TRO F,200
54200		CAMG J,F
54300		POPJ P,
54400		JRST ISOKA
54500	↑SORTL:	HRRZ D,(C)	;GET LIST
54600		MOVEI E,	;NEW LIST
54700		JUMPE D,CPOPJ
54800	SRLP2:	MOVEI F,300000
54900		MOVEI G,D	;NOW FIND SMALLEST ENTRY IN D LIST
55000	SRLP1:	HRRZ H,(G)
55100		JUMPE H,SRP1
55200		HRRZ T,1(H)
55300		ANDI T,37177
55400		TRNN T,100
55500		TRO T,200
55600		CAML T,F
55700		JRST .+3
55800		MOVE F,T
55900		MOVE T1,G
56000		MOVE G,H
56100		JRST SRLP1
56200	SRP1:	HRRZ H,(T1)
56300		HRRZ G,(H)
56400		HRRM G,(T1)
56500		HRRM E,(H)
56600		MOVE E,H
56700		MOVEI T,400000
56800		ANDCAM T,1(E)
56900		JUMPN D,SRLP2
57000		HRRM E,(C)
57100		POPJ P,
57200	
57300	BEND
57400	NDCNT:	MOVE T,NODPNT
57500		MOVEI C,
57600		SKIPE (T)
57700		AOJA T,.-1
57800		ADDI C,1
57900		SKIPE 1(T)
58000		AOJA T,.-4
58100		POPJ P,
58200	
     

00100	BEGIN ST
00200	ACCS
00300	↑ST:	PUSHJ P,WRD
00400		JUMPE B,STDON
00500		MOVE A,B
00600		MOVEI B,
00700		TRNE A,376
00800		PUSHJ P,WRD
00900		MOVEI C,0
01000	LOP1:	PUSHJ P,MATCH
01100		JRST MAT1
01200		JRST NOTHER
01300		AOJA C,LOP1
01400	MAT1:	PUSHJ P,WRD
01500		MOVS E,B	;GET HELLIWELL # IN LEFT
01600		PUSHJ P,WRD	;GET LOCATION
01700		LSH B,-6
01800		DPB B,[POINT 5,E,30]
01900		LSH B,-6
02000		DPB B,[POINT 5,E,35]
02100		MOVE G,C
02200		MOVEI C,777
02300	LOP2:	CAML E,HTYPS(C)
02400		JRST FND1
02500		SUBI C,10
02600		JRST LOP2
02700	FND1:	CAMLE E,HTYPS(C)
02800		AOJA C,FND1
02900		CAMN E,HTYPS(C)
03000		JRST ST
03100		MOVE D,[XWD HTYPS+1,HTYPS]
03200		BLT D,HTYPS-2(C)
03300		MOVEM E,HTYPS-1(C)
03400		MOVEM G,TYPTYP(E)
03500		JRST ST
03600	NOTHER:	OUTSTR [ASCIZ /UNKNOWN GATE ID: /]
03700		OUTSTR A
03800		JRST 4,.
03900	STDON:	
04000	BEND ST
04100	BEGIN TABLE MAKE
04200	ACCS
04300		MOVEI C,1777
04400	LOP1:	SKIPN D,TYPTYP(C);GET TYPE # FOR BODY
04500		SOJGE C,.-1	;NONE, GO TO NEXT
04600		JUMPE D,DONE	;ALL DONE
04700		HRRZ E,TYPTBN(D);GET # OF PINS
04800		MOVEI F,3(E)	;ADD 3 FOR FIRST TABLE
04900		PUSHJ P,GETFST	;GET A BLOCK THAT LONG
05000		MOVEM F,TYPPNT(C);DEPOSIT POINTER
05100		MOVEI F,2	;GET LEGTH FOR SECOND TABLE
05200		PUSHJ P,GETFST	;GET A BLOCK
05300		HRLM F,TYPPNT(C);DEPOSIT POINTER
05400		HLRZ G,TYPTBN(D)	;GET SIZE #
05500		MOVE T,TTAB8(G)
05600		MOVEM T,(F)
05700		MOVE H,C
05800		ANDI H,37	;GET ROW
05900		LSH H,7
06000		OR H,TTAB4(G)	;GET STARTING BLANK-OUT ROW
06100		MOVE A,TTAB5(G)	;GET COUNT
06200		MOVE T1,TTAB6(G);GET EXCURSIONS
06300		MOVEI T2,400000	;GET EXCURSIONS
06400		MOVE E,C
06500		ANDI E,1740	;GET COLUMN
06600		LSH E,4
06700		OR T1,E
06800		OR T2,E
06900	LOP11:	MOVEI J,HLIST(H)
07000		PUSHJ P,MARK	;MARK THE TABLE
07100		TRC H,177
07200		MOVEI J,HLIST+1(H)
07300		PUSHJ P,MARK
07400		TRZ H,177
07500		OR H,TTAB4(G)
07600		MOVEI J,HLIST-3(H)
07700		MOVEI T1,400000
07800		MOVEI T2,400000
07900		PUSHJ P,MARK
08000		MOVE H,E
08100		LSH H,-2
08200		ORI H,177	;GET STARTING BLANK-OUT COLUMN
08300		MOVE A,TTAB7(G)	;GET COUNT
08400		MOVEI T1,400100	;GET EXCURSIONS
08500		MOVEI T2,400077	;...
08600		MOVE E,C
08700		ANDI E,37
08800		LSH E,=9
08900		OR T1,E
09000		OR T2,E
09100	LOP12:	MOVEI J,VLIST(H)
09200		PUSHJ P,MARK
09300		ADDI H,1
09400		TRNN H,177
09500		SUBI H,200
09600		SOJG A,LOP12
09700		SOJGE C,LOP1
09800	DONE:
09900		SETZM (FS)
10000		ADDI FS,1
10100		MOVEM FS,NODPNT;SAVE POINTER TO START OF NODE TABLE
10200	LOP3:	PUSHJ P,WRD	;GET WORD
10300		JUMPE B,DONA	;DONE WITH FILE?
10400	LOP2:	HLRE A,B	;GET GATE #, 0(CEPIN), OR -1(FLAG)
10500		JUMPLE A,PNT1	;GATE?
10600		PUSHJ P,HGFIND	;YES, FIND ENTRY
10700		HRRZ C,HTYPS(D)	;GET ENTRY LOC
10800		MOVE E,TYPTYP(C);GET GATE TYPE
10900		ADD B,TYPCTB(E)	;GET PIN # CONV. TABLE ENTRY
11000		HRL C,-1(B)	;PUT IN PIN #
11100		MOVSM C,(FS)	;DEPOSIT ENTRY
11200		HLRZ T1,C	;GET PIN #
11300		MOVEI T2,1
11400		LSH T2,(T1)	;FORM BIT ASSOC. WITH PIN
11500		MOVS T,TYPPNT(C);GET POINTER TO "USED BIT" WORD
11600		ANDCAM T2,(T)
11700		ADDI FS,1	;GO TO NEXT LOC
11800		CAML FS,JOBREL	;NEED CORE?
11900		PUSHJ P,GETCOR	;YES, GET IT
12000		PUSHJ P,WRD	;GET NEXT WORD
12100		JRST LOP2
12200	PNT1:	MOVEM B,(FS)	;DEPOSIT ENTRY
12300		ADDI FS,1	;GO TO NEXT
12400		CAML FS,JOBREL	;NEED CORE?
12500		PUSHJ P,GETCOR	;YES, GET IT
12600		JUMPE B,LOP3	;END OF NODE?
12700		PUSHJ P,WRD	;NO, GET NEXT WORD
12800		JRST LOP2
12900	DONA:	MOVEM FS,NODEND#
13000		ADDI FS,1
13100		SETZM -1(FS)
13200	;WE NOW FREE UP SPACE ASSOCIATED WITH UNUSED PINS
13300		MOVEI C,1777
13400	LOP22:	SKIPN D,TYPPNT(C);GET DIP ENTRY
13500		SOJG C,.-1
13600		JUMPE D,DONB	;DONE?
13700		MOVEI E,0	;INITIAL PIN #
13800		MOVEI A,1	;INITIAL PIN BIT
13900		JRA D,.+1	;GET "FREE PIN" BIT WORD
14000	LOP21:	TDNE D,A	;THIS PIN FREE?
14100		PUSHJ P,FREEUP	;YES, FREE IT
14200		LSH A,1		;GO TO NEXT PIN
14300		MOVN B,A	;DONE?
14400		TDNE B,D	;DONE?
14500		AOJA E,LOP21	;NO, LOOP
14600		SOJG C,LOP22
14700	DONB:
14800		MOVE A,NODPNT	;GET START OF TABLE
14900	;WE ARE NOW GOING TO SORT THE ENTRIES IN EACH NODE:::
15000	
15100	LOOP1:	MOVE B,A	;GET NEXT FIRST ENTRY POINTER
15200	LOOP2:	MOVEI C,1(B)	;GET NEXT SECOND POINTER
15300		SKIPN D,(B)	;FIRST ONE 0?
15400		JRST DON1	;YES, DONE WITH THIS NODE
15500		SKIPN (C)
15600		AOJA B,LOOP2
15700		CAMG D,(C)	;FIRST LARGER THAN SECOND?
15800		AOJA C,.-3	;NO, TRY ANOTHER SECOND
15900		SKIPN (C)	;SECOND ONE 0?
16000		AOJA B,LOOP2	;YES, TRY NEXT FIRST
16100		EXCH D,(C)	;NO, SWITCH ENTRIES
16200		MOVEM D,(B)	;...
16300		JRST LOOP1	;AND START OVER
16400	DON1:	MOVEI A,1(B)	;GO TO NEXT NODE
16500		SKIPE (A)	;FIRST ENTRY 0?
16600		JRST LOOP1	;NO, CONTINUE
16700	 BEND TABLE
16800	BEGIN DOIT
16900		PUSHJ P,ROUTE	;ROUTE THE THING
17000	BEND
17100	BEGIN OUTIT
17200	ACCS
17300	DEFINE FOO1 $(L,HH,FUD)
17400	{	MOVEI A,1
17500	LOP$L:	MOVEI B,-1(A)
17600		LSH B,7
17700		MOVE C,HH$POS-1(A)
17800		IFDIF <>,<FUD>,<SUBI C,2>
17900		MOVEI D,
18000	LOPP$L:	SKIPE HH$LIST(B)
18100		MOVE D,B
18200		ADDI B,1
18300		TRNE B,77
18400		JRST LOPP$L
18500		ANDI D,177
18600		IFDIF <>,<FUD>,
18700	<ADDI D,1
18800	LDB E,[POINT 5,B,28]
18900	MOVEM D,INFP(E)>
19000		ADD C,D
19100		ADDI B,200
19200		MOVEI D,
19300	LLOP$L:	SKIPN HH$LIST(B)
19400		JRST .+3
19500		JUMPN D,.+2
19600		MOVE D,B
19700		ADDI B,1
19800		TRNE B,77
19900		JRST LLOP$L
20000		IFDIF <>,<FUD>,<ANDI D,177
20100	SUBI D,1
20200	LDB E,[POINT 5,B,28]
20300	MOVEM D,INFN-1(E)>
20400		MOVNS D
20500		ANDI D,77
20600		ADD C,D
20700		ADDI C,1
20800		MOVEM C,HH$POS(A)
20900		CAIGE A,25
21000		AOJA A,LOP$L
21100	}
21200	FOO1(H,H,1)
21300		PUSHJ P,CROUTE
21400	FOO1(V,V,)
21500		MOVEI C,1777
21600	LOP5:	SKIPN D,TYPTYP(C)	;GET TYPE
21700		SOJG C,.-1
21800		JUMPE D,DON1	;DONE?
21900		HLRZ F,TYPTBN(D);GET SIZE #
22000		MOVE A,C
22100		MOVE B,C
22200		ANDI B,37	;GET Y
22300		LSH A,-5	;GET X
22400		MOVE A,VPOS(A)
22500		MOVE B,HPOS(B)
22600		ADD A,TTAB10(F)	;ADJUST TO CENTER OF DIP
22700	IFN NFSW,{
22800		LDB T,[POINT 5,C,30];GET COL.
22900		LSH T,=6	;ADJUST
23000		HRL T,TYPTBN(D)	;GET # OF PINS
23100		DPB C,[POINT 5,T,23];GET ROW
23200		PUSHJ P,WOUT
23300		PUSHJ P,POSOUT
23400	}
23500		SOJG C,LOP5
23600	DON1:
23700	IFN NFSW,{
23800		MOVEI T,
23900		PUSHJ P,WOUT
24000		MOVEI T,400000
24100		MOVEM T,SIDE	;HORIZ. SIDE
24200	}
24300		MOVEI T2,=128*=20-1
24400	CLS1:	SKIPN HLIST(T2)
24500		SOJG T2,.-1
24600		JUMPE T2,FIN1
24700		MOVEI C,HLIST(T2)
24800		PUSHJ P,SORTL
24900		SOJG T2,CLS1
25000	FIN1:	MOVEI T2,=128*=20-1
25100	CLS2:	SKIPN VLIST(T2)
25200		SOJG T2,.-1
25300		JUMPE T2,FIN2
25400		MOVEI C,VLIST(T2)
25500		PUSHJ P,SORTL
25600		SOJG T2,CLS2
25700	FIN2:	MOVEI T2,=128*=20-1
25800	CLS3:	SKIPN D,HLIST(T2)
25900		SOJG T2,.-1
26000		JUMPE D,FIN3
26100		MOVE J,T2
26200		ANDI J,177
26300		LDB J1,[POINT 5,T2,28]
26400		DPB J1,[POINT 5,J,26]
26500		TRNN J,100
26600		TRO J,200
26700		PUSHJ P,FEDREM
26800		HRRZ D,(D)
26900		JUMPN D,.-2
27000		SOJG T2,CLS3
27100	FIN3:
27200	DEFINE FOO1 $(A,B,AC1,AC2,QQ)
27300	{	MOVEI C,=128*=20-1
27400	LLOP$A:	SKIPN D,B$LIST(C)
27500		SOJG C,.-1
27600		JUMPE C,DOG$A
27700		MOVE AC2,C
27800		LSH AC2,2
27900		DPB C,[POINT 7,AC2,35]
28000		HRLS AC2
28100		ANDCM AC2,[740000,,740000]
28200		SKIPL AC1,1(D)
28300		PUSHJ P,LINE$QQ
28400		HRRZ D,(D)
28500		JUMPN D,.-4
28600		SOJG C,LLOP$A
28700	DOG$A:
28800	}
28900	 DEFINE DPOS (E,F,C)
29000	{	MOVE E,C
29100		MOVE F,C
29200		ANDI F,37
29300		LSH E,-5
29400		MOVE E,VPOS(E)
29500		MOVE F,HPOS(F)}
29600	 FOO1 (1,H,F,E)
29700		MOVEI C,1777
29800	LLOP4:	SKIPN D,TYPPNT(C)
29900		SOJG C,.-1
30000		JUMPE C,DOG4
30100		SKIPN H,2(D)	;GET HORIZONTAL ZIG BITS
30200		JRST .-3	;NONE
30300		DPOS (E,F,C)
30400		MOVE G,TYPTYP(C);GET TYPE
30500		MOVEI J,1
30600		MOVEI J1,	;INITIAL PIN #
30700	LLOPP4:	TDZN H,J	;THIS PIN HAVE A ZIG?
30800		JRST LPNT4	;NO
30900		PUSHJ P,MPIN	;GET X,Y (A,B) OF DIP PIN
31000	IFN NFSW,{
31100		MOVEI T,400000
31200		PUSHJ P,WOUT	;PUT OUT CODE WORD
31300		PUSHJ P,POSOUT	;PUT OUT X,Y OF PIN
31400		ADDI A,2
31500		PUSHJ P,POSOUT	;PUT OUT X,Y OF OTHER PIN
31600	}
31700	LPNT4:	LSH J,1
31800		ADDI J1,1
31900		JUMPN H,LLOPP4
32000		SOJG C,LLOP4
32100	DOG4:
32200	IFN NFSW,{
32300		MOVE T,[400000,,400000]
32400		MOVEM T,SIDE	;VERT. SIDE
32500	}
32600		FOO1 (7,V,E,F,Q)
32700		MOVEI C,1777
32800	LLOP3:	SKIPN D,TYPPNT(C)
32900		SOJG C,.-1
33000		JUMPE C,DOG3
33100		DPOS (E,F,C)
33200		MOVE G,TYPTYP(C)
33300		MOVE H,(D)
33400		SKIPN T,1(D)	;ANY ZIG BITS?
33500		JUMPE H,LLPNT3	;LEAVE IF NONE
33600		MOVEI J,1
33700		MOVEI J1,
33800		OR H,T
33900	LLOPP3:	TDZN H,J	;THIS ZIG BIT ON?
34000		JRST LLPR3	;NO
34100		PUSHJ P,MPIN	;GET X,Y OF DIP PIN
34200	IFN NFSW,{
34300		MOVE T,[400000,,400000]
34400		PUSHJ P,WOUT	;VERT SIDE CODE WORD
34500		PUSHJ P,POSOUT	;PUT OUT POSITION}
34600		TDNN J,(D)	;ZIG LEFT?
34700		JRST LLPT3	;NO
34800	IFN NFSW,{
34900		ADDI A,1
35000		PUSHJ P,POSOUT	;ZIG LEFT}
35100		TDNE J,1(D)	;ZIG RIGHT TOO?
35200		JRST .+3	;YES
35300		AOS XPO		;NO, ADJUST POSITION
35400		JRST LLPR3
35500	IFN NFSW,{
35600		MOVE T,[400000,,400000]
35700		PUSHJ P,WOUT
35800		SUBI A,1
35900		PUSHJ P,POSOUT	;PUT OUT PIN POS.}
36000	LLPT3:
36100	IFN NFSW,{SUBI A,1
36200		PUSHJ P,POSOUT}
36300	LLPR3:	LSH J,1
36400		ADDI J1,1
36500		JUMPN H,LLOPP3
36600	LLPNT3:
36700		HRRZ H,TYPTBN(G);GET # OF PINS
36800		ADDI D,3
36900		MOVEI J1,
37000		SKIPE J,(D)
37100		PUSHJ P,OUTREG
37200		ADDI J1,1
37300		ADDI D,1
37400		SOJG H,.-4
37500		HLRZ D,TYPPNT(C)	;GET "STRAIGHT"TABLE
37600		SKIPL (D)	;NONE?
37700		JRST LPNT5	;NONE
37800		MOVE H,1(D)	;GET "UP-DOWN JOIN" BITS
37900		MOVEI D,	;INITIAL PIN #
38000	LLOP5:	TRNN H,1	;THIS ENTRY?
38100		JRST LPNTT5	;NONE HERE
38200		MOVE J1,D	;GET PIN #
38300		PUSHJ P,MPIN	;GET PIN X,Y
38400	IFN NFSW,{
38500		MOVE T,[400000,,400000]
38600		PUSHJ P,WOUT
38700		PUSHJ P,POSOUT}
38800		HLRZ J,TYPTBN(G);GET SIZE #
38900		ADD B,TTAB9(J)	;MOVE TO BOTTOM PIN
39000	IFN NFSW,{PUSHJ P,POSOUT}
39100	LPNTT5:	LSH H,-1	;GET TO NEXT
39200		ADDI D,1	;NEXT PIN #
39300		JUMPN H,LLOP5	;LOOP IF ANY MORE
39400	LPNT5:
39500		SOJG C,LLOP3
39600	DOG3:
39700	 FOO1 (2,V,E,F,Z)
39800	 RELEAS 1,
39900	 RELEAS 2,
40000	CALLI 12
40100	BEND OUTIT
40200	
40300	BEGIN OSUB
40400	ACCS
40500	UPNT1:	TRNN T,100
40600		JRST UPNT3
40700		MOVE T,INFN(T1)
40800		JRST UPNT4
40900	UPNT2:	TRNN T,100
41000		MOVE T,INFP(T1)
41100		JRST UPNT4
41200	
41300	UNDO:	LDB T1,[POINT 5,T,26]
41400		TRCN T,77	;IS IT INFINITY?
41500		JRST UPNT1	;YES
41600	UPNT3:	TRCN T,77
41700		JRST UPNT2
41800	UPNT4:	ANDI T,177
41900		TRNE T,100
42000		OR T,[XWD -1,777700]
42100		ADD T1,T2
42200		ADD T,(T1)
42300		POPJ P,
42400	LIT2:	XWD 200000,200000
42500	 DEFINE FUDL $(A,B,C)
42600	{	T$C$NE E,A$00000
42700		T$C$O T,B
42800	}
42900	
43000	↑LINEZ:	TDNE E,LIT2
43100		POPJ P,
43200		TDNE F,LIT2
43300		POPJ P,
43400		JRST LINE
43500	↑LINEQ:	TDNE E,LIT2
43600		JRST LINE
43700		TDNN F,LIT2
43800		POPJ P,
43900	↑LINE:	MOVS T,E
44000		MOVEI T2,HPOS
44100		PUSHJ P,UNDO
44200		MOVE B,T
44300		MOVE T,F
44400		AND T,[740000,,740000]
44500		OR E,T
44600		MOVS T,F
44700		MOVEI T2,VPOS
44800		PUSHJ P,UNDO
44900		MOVE A,T
45000	IFN NFSW,{
45100		TLNN E,200000	;ZIG BIT?
45200		JRST LP1
45300		MOVE T,SIDE
45400		TRNE E,400000
45500		TLC T,400000
45600		PUSHJ P,WOUT
45700		PUSHJ P,POSOUT
45800		PUSH P,B
45900		ADDI B,1
46000		TLNE E,40000
46100		SUBI B,2
46200		PUSHJ P,POSOUT
46300		POP P,B
46400	LP1:
46500		MOVE T,SIDE
46600		TRNE E,400000
46700		TLC T,400000
46800		FUDL (1,1,L)
46900		FUDL (1,1,R)
47000		PUSHJ P,WOUT
47100		PUSHJ P,POSOUT}
47200		MOVE T,E
47300		MOVEI T2,HPOS
47400		PUSHJ P,UNDO
47500		MOVE B,T
47600		MOVE T,F
47700		MOVEI T2,VPOS
47800		PUSHJ P,UNDO
47900		MOVE A,T
48000	IFN NFSW,{PUSHJ P,POSOUT
48100		TRNN E,200000
48200		POPJ P,
48300		MOVE T,SIDE
48400		PUSHJ P,WOUT
48500		PUSHJ P,POSOUT
48600		ADDI B,1
48700		TRNE E,40000
48800		SUBI B,2
48900		PUSHJ P,POSOUT}
49000		POPJ P,
49100	BEND
49200	;OSUB
49300	
     

00100	SLDO:	MOVE C,NODPNT
00200		MOVEM C,SLA
00300		MOVEM C,NEWPTS#
00400		MOVEI C,12
00500		MOVEM C,RADX#
00600		MOVEI C,NEWT
00700		MOVEM C,NEWP
00800	SLLP1:	MOVEM T,SLPSAV#
00900		ADDI T,3
01000		MOVEI C,CMTABN
01100	SLLP2:	MOVE D,(T)
01200		XOR D,CMTAB-1(C)
01300		AND D,CMATB-1(C)
01400		JUMPE D,SLPNT1
01500		SOJG C,SLLP2
01600	SLERR:	OUTSTR [ASCIZ /SL STRING ERROR
01700	/]
01800		JRST 4,.
01900	SLPNT1:	JRST @CMRTB-1(C)
02000	CMTAB:	ASCII /NEW←/
02100		ASCII /SETN/
02200		ASCII /RTE/
02300		ASCII /IF/
02400		ASCII /FREE/
02500		ASCII /A←/
02600		ASCII /DONE/
02700	CMTABN←←.-CMTAB
02800	CMATB:	BYTE (7)0-1,-1,-1,-1
02900		BYTE (7)0-1,-1,-1,-1
03000		BYTE (7)0-1,-1,-1
03100		BYTE (7)0-1,-1
03200		BYTE (7)0-1,-1,-1,-1
03300		BYTE (7)00,-1,00,00
03400		BYTE (7)0-1,-1,-1,-1
03500	CMRTB:	SLNEW
03600		SLSETN
03700		SLRTE
03800		SLIF
03900		SLFREE
04000		SLLA
04100		SLDONE
04200	
04300	SLLA:	HRLI T,440700
04400		ILDB C,T
04500		SUBI C,101
04600		JUMPL C,SLERR
04700		CAILE C,14
04800		JRST SLERR
04900		IBP T
05000		PUSHJ P,EVAL
05100		AOSA SLPSAV
05200		MOVEM A2,SLA(C)
05300		MOVE T,@SLPSAV
05400		JRST SLLP1
05500	SLNEW:	HRLI T,100700
05600		PUSHJ P,EVAL
05700		AOS SLPSAV
05800		MOVEM A2,@NEWP
05900		AOS NEWP
06000		MOVE T,@SLPSAV
06100		JRST SLLP1
06200	SLSETN:	MOVE C,NEWPTS
06300		MOVE D,NEWP
06400		HRLI C,NEWT
06500		SUBI D,NEWT
06600		JUMPE D,SLS1
06700		ADDB D,NEWPTS
06800		BLT C,-1(D)
06900		SETZM (D)
07000		AOS NEWPTS
07100		MOVEI D,NEWT
07200		MOVEM D,NEWP
07300		MOVE T,@SLPSAV
07400		JRST SLLP1
07500	SLS1:	AOS SNCNT
07600		MOVE T,@SLPSAV
07700		JRST SLLP1
07800	SLRTE:	HRLI T,170700
07900		PUSHJ P,EVAL
08000		JRST [AOS SLPSAV
08100			MOVE T,@SLPSAV
08200			JRST SLLP1]
08300		MOVE SS,(A2)
08400		ILDB C,T
08500		CAIE C,","
08600		JRST SLERR
08700		PUSHJ P,EVAL
08800		JRST [AOS SLPSAV
08900			MOVE T,@SLPSAV
09000			JRST SLLP1]
09100		MOVE DD,(A2)
09200		CAMGE SS,DD
09300		EXCH SS,DD
09400		TRZ SS,700000
09500		TRZ DD,700000
09600		PUSHJ P,FNUM
09700		MOVE T,DISTAB(F)
09800		PUSHJ P,(T)
09900		MOVE T,@SLPSAV
10000		JRST SLLP1
10100	SLIF:	HRLI T,260700
10200		PUSHJ P,EVAL
10300		JFCL
10400		JUMPL A2,.+4
10500		AOS SLPSAV
10600		JUMPE A2,.+2
10700		AOS SLPSAV
10800		MOVE T,@SLPSAV
10900		JRST SLLP1
11000	SLFREE:	HRLI T,100700
11100		PUSHJ P,EVAL
11200		JRST  [	AOS SLPSAV
11300			MOVE T,@SLPSAV
11400			JRST SLLP1]
11500		MOVE T,(A2)
11600		HLRZ C,T	;GET DIP #
11700		MOVS D,TYPPNT(C);GET ENTRY
11800		LDB E,[POINT 15,T,35]	;GET PIN #
11900		MOVEI A1,1
12000		LSH A1,(E)	;GET PIN BIT
12100		ORM A1,(D)	;SET BIT (PIN FREE)
12200		MOVE D,(D)	;GET BIT WORD
12300		LSH A1,-1	;SEE ABOUT PREV. PIN
12400		JUMPE A1,SLFR1	;NO PREV PIN?
12500		TDNN D,A1
12600		JRST SLFR1	;PREV PIN FREE?
12700		SUBI E,1	;YES, CALL WITH IT TOO
12800		PUSHJ P,FREEUP
12900		ADDI E,1
13000	SLFR1:	PUSHJ P,FREEUP
13100		MOVE D,TYPPNT(C)
13200		ADDI D,3(E)
13300		SKIPN A2,(D)
13400		JRST SLFR2
13500		HRRZ A1,TYPTYP(C)
13600		HLRZ A1,TYPTBN(A1)
13610		TRNN E,1	;EVEN PIN?
13620		TLNE A2,-1	;YES, UP ENTRY?
13630		SKIPA A3,TTAB11(A1);NO OR YES, PUT IN DUMMY ENTRY
13640		JRST SLFR3	;YES, AND NO, DON'T DO IT
13650		DPB C,[POINT 5,A3,26]
13660		DPB C,[POINT 5,A3,8]
13670		TLO A3,400000	;MAKE UP DUMMY ENTRY
13680		LDB A4,[POINT 5,C,30];GET DIP ROW
13690		LSH A4,7	;SHIFT IT
13700		SUBI E,1	;PREV. COL
13705		ANDI E,177
13710		OR A4,E
13715		ADDI E,1
13720		ANDI E,177
13725		ADDI A4,VLIST	;TABLE POINTER
13730		PUSH P,F	;SAVE F
13735		MOVEI F,2
13740		PUSHJ P,GETFST
13745		MOVEM A3,1(F)	;DEPOSIT DUMMY ENTRY IN NEW BLOCK
13750		HRRZ A3,(A4)	;LINK IN ENTRY
13755		HRRM F,(A4)	;...
13760		MOVEM A3,(F)	;...
13765		POP P,F
13770	SLFR3:
13800		MOVE A1,TTAB1(A1)	;GET PIN ROW
13900		TRNE E,1	;EVEN?
14000		MOVNS A1	;NO, GET PIN ROW
14100		DPB C,[POINT 5,A1,26]
14200		TLNN A2,-1
14300		HRL A2,A1
14400		TRNN A2,-1
14500		HRR A2,A1
14600		MOVE A3,F
14700		MOVEI F,2
14800		PUSHJ P,GETFST
14900		TLO A2,400000
15000		MOVEM A2,1(F)
15100		HRRZ A2,(A3)
15200		HRRM F,(A3)
15300		MOVEM A2,(F)
15400	SLFR2:	MOVE T,@SLPSAV
15500		JRST SLLP1
15600	
15700	SLDONE:
15800		POPJ P,
15900	
16000	EVAL:	MOVEI A1,
16100		MOVEI A3,
16200		MOVEI A2,
16300	EVL1:	ILDB E,T
16400		SKIPN F,ETAB(E)
16500		JRST SLERR
16600		JRST (F)
16700	EVMIN:	SETCA A1,
16800		JRST EVL1
16900	EVLP:	PUSH P,A3
17000		PUSH P,A2
17100		PUSH P,A1
17200		PUSHJ P,EVAL
17300		JRST [POP P,A1
17400			POP P,A2
17500			POP P,A3
17600			POPJ P,]
17700		POP P,A1
17800		MOVE A4,A2
17900		SKIPE A1
18000		MOVN A4,A2
18100		POP P,A2
18200		POP P,A3
18300		XCT OPTAB(A3)
18400		MOVEI A1,
18500		ILDB E,T
18600	  DEFINE FOO1 (A,B)
18700	{	CAIN E,"A"
18800		JRST [MOVEI A3,B
18900			JRST EVLP]}
19000		FOO1(+,0)
19100		FOO1(-,1)
19200		FOO1(∧,2)
19300		FOO1(∨,3)
19400		CAIN E,")"
19500		JRST CPOPJ1
19600		CAIE E,";"
19700		CAIN E,","
19800		JRST EVRET
19900		JRST SLERR
20000	EVAT:	ILDB E,T
20100		MOVE F,FTAB(E)
20200		JRST @FT1(F)
20300	  DEFINE FOO1 (A)
20400	{	PUSHJ P,EVP
20500		POPJ P,
20600		A
20700		JRST EVL2}
20800	EAAP:	FOO1(<HRRZ A4,(A4)>)
20900	EAAD:	FOO1(<HLRZ A4,(A4)>)
21000	EAAC:	FOO1(<LDB A4,[POINT 5,(A4),12]>)
21100	EAAR:	FOO1(<LDB A4,[POINT 5,(A4),17]>)
21200	EAAE:	FOO1(<MOVE A4,(A4)>)
21300	   DEFINE FOO 3(A,B)
21400	{ DEFINE S$3A {B}}
21500	  DEFINE FO(A,B)
21600	{FOO(→"A",B)}
21700	
21800	FO(<(>,EVLP)
21900	FO(-,EVMIN)
22000	FO(@,EVAT)
22100	FO(N,EVNX)
22200	FO(T,EVTH)
22300	FO(#,EVNM)
22400	FOR I E <ABCDEFGHIJKLM>
22500	{FO(I,EVLT)
22600	}
22700	FO(∀,EVAB)
22800	FO(∞,EVIN)
22900	FO(∃,EVEG)
23000	FOR I E <0123456789>
23100	{FO(I,EVDG)
23200	}
23300	ETAB:	FOR @5 I←0,177
23400	{IFDEF S$5I,<S$5I;>0
23500	}
23600	
23700	OPTAB:	ADD A2,A4
23800		SUB A2,A4
23900		AND A2,A4
24000		OR A2,A4
24100	
24200	DEFINE FOO 3(A,B)
24300	{ DEFINE F$3A  {B}}
24400	FO(P,1)
24500	FO(G,2)
24600	FO(D,3)
24700	FO(C,4)
24800	FO(R,5)
24900	FO(N,6)
25000	FO(E,7)
25100	FTAB:	FOR @5 I←0,177
25200	{IFDEF F$5I,<F$5I;>0
25300	}
25400	
25500	FT1:	SLERR
25600		EAAP
25700		SLERR
25800		EAAD
25900		EAAC
26000		EAAR
26100		SLERR
26200		EAAE
26300	
26400	EVP:	PUSH P,A3
26500		PUSH P,A2
26600		PUSH P,A1
26700		PUSHJ P,EVAL
26800		JRST [POP P,A1
26900			POP P,A2
27000			POP P,A3
27100			POPJ P,]
27200		MOVE A4,A2
27300		POP P,A1
27400		POP P,A2
27500		POP P,A3
27600		AOS (P)
27700		POPJ P,
27800	EVNX:	ILDB E,T
27900		MOVE F,FTAB(E)
28000		JRST @FT2(F)
28100	EANP:	PUSHJ P,EVP
28200		POPJ P,
28300		ADDI A4,1
28400	EVL3:	HLRZ A5,A4
28500		CAIGE A5,(A4)
28600		POPJ P,
28700	EVL2:	MOVE A2,A4
28800		SKIPE A1
28900		MOVN A2,A4
29000		AOS (P)
29100		POPJ P,
29200	EAND:	PUSHJ P,EVP
29300		POPJ P,
29400		HLRZ A5,(A4)
29500		ADDI A4,1
29600		HLRZ A6,(A4)
29700		CAMN A5,A6
29800		AOJA A4,.-2
29900		JRST EVL3
30000	EANC:	PUSHJ P,EVP
30100		POPJ P,
30200		LDB A5,[POINT 5,(A4),12]
30300		ADDI A4,1
30400		LDB A6,[POINT 5,(A4),12]
30500		CAMN A5,A6
30600		AOJA A4,.-2
30700		JRST EVL3
30800	EANN:	PUSHJ P,EVP
30900		POPJ P,
31000		SKIPE (A4)
31100		AOJA A4,.-1
31200		ADDI A4,1
31300		SKIPN (A4)
31400		POPJ P,
31500		JRST EVL2
31600	FT2:	SLERR
31700		EANP
31800		SLERR
31900		EAND
32000		EANC
32100		SLERR
32200		EANN
32300		SLERR
32400	
32500	EVTH:	ILDB E,T
32600		MOVE F,FTAB(E)
32700		JRST @FT3(F)
32800	EATD:	PUSHJ P,EVP
32900		POPJ P,
33000		HLRZ A5,(A4)
33100		HLRZ A6,-1(A4)
33200		CAME A5,A6
33300		JRST EATD1
33400		SKIPE -1(A4)
33500		SOJA A4,.-5
33600	EATD1:	MOVE E,A4
33700		HLRZ A6,(E)
33800		CAME A5,A6
33900		JRST EATD2
34000		SKIPE (E)
34100		AOJA E,.-4
34200	EATD2:	HRLI A4,-1(E)
34300		JRST EVL2
34400	EATN:	PUSHJ P,EVP
34500		POPJ P,
34600		SKIPE -1(A4)
34700		SOJA A4,.-1
34800		MOVE A5,A4
34900		SKIPE 1(A5)
35000		AOJA A5,.-1
35100		HRL A4,A5
35200		JRST EVL2
35300	EVNM:	ILDB E,T
35400		MOVE F,FTAB(E)
35500		JRST @FT4(F)
35600	EAMP:	PUSHJ P,EVP
35700		POPJ P,
35800		HRRZ A5,A4
35900		HLRZ A4,A4
36000		SUB A4,A5
36100		ADDI A4,1
36200		JRST EVL2
36300	FT3:	SLERR
36400		SLERR
36500		SLERR
36600		EATD
36700		SLERR
36800		SLERR
36900		EATN
37000		SLERR
37100	FT4:	SLERR
37200		EAMP
37300		SLERR
37400		SLERR
37500		SLERR
37600		SLERR
37700		SLERR
37800		SLERR
37900	
38000	EVLT:	SUBI E,101
38100		MOVE A4,SLA(E)
38200		JRST EVL2
38300	EVAB:	PUSHJ P,EVP
38400		POPJ P,
38500		MOVMS A4
38600		JRST EVL2
38700	EVIN:	HRRZI A4,-1
38800		JRST EVL2
38900	EVEG:	MOVEI F,10
39000		MOVEM F,RADX
39100		JRST EVL1
39200	EVDG:	MOVEI A4,-60(E)
39300		ILDB E,T
39400		CAIN E,","
39500		JRST EDGDN
39600		CAIL E,60
39700		CAIL E,72
39800		JRST SLERR
39900		IMUL A4,RADX
40000		ADDI A4,-60(E)
40100		JRST EVDG+1
40200	EDGDN:	MOVEI F,12
40300		MOVEM F,RADX
40400		JRST EVL2
40500	EVRET:	AOS (P)
40600		ADD T,[XWD 70000,0]
40700		POPJ P,
40800	
40900	  DEFINE FOO1 $(A,B,C)
41000	{IFDIF <>,<B>,<A$.$B;>A$C}
41100	  DEFINE FOO2 $(A,B)
41200	{A$B:}
41300	  DEFINE TNAM %(A)
41400	{DEFINE ENT $(B,C,D,E,F)
41500	{IFDIF <>,<B>,<A%.$B:>
41600	FOO2(A,→FOON)  FOON←←FOON+1
41700	FOO1(A,D,→FOON)
41800	FOO1(A,E,→FOON)
41900	FOO1(A,F,→FOON)
42000	ASCIZ /C;/}
42100	FOON←←0}
42200	
42300	TNAM(GP)
42400	GP:
42500	ENT(26,<A←TNA>)
42600	ENT(,<D←0,>)
42700	ENT(14,<B←D>)
42800	ENT(,<E←TDA>)
42900	ENT(,<F←TDNDA>,,2)
43000	ENT(,<G←E>)
43100	ENT(,<H←F>)
43200	ENT(,<I←500,>)
43300	ENT(7,<J←(@PG-@PH)>)
43400	ENT(,<IF(I-∀J)>,4,4)
43500	ENT(,<I←∀J>)
43600	ENT(,<C←G>)
43700	ENT(,<D←H>)
43800	ENT(4,<IFJ>,5,5,6)
43900	ENT(5,<G←NPG>,7,8)
44000	ENT(6,<H←NPH>,7,8)
44100	ENT(2,<C←0,>)
44200	ENT(8,<IF(#PE-1,)>,15,15)
44300	ENT(,<F←E>)
44400	ENT(13,<G←NPF>,,9)
44500	ENT(,<IF(@PG-@PF-1,)>,10,10,11)
44600	ENT(10,<H←NPG>,,11)
44700	ENT(,<IF(@PH-@PF-2,)>,11,,11)
44800	ENT(,<RTEH,F>,12)
44900	ENT(11,<RTEG,F>)
45000	ENT(12,<F←G>,13)
45100	ENT(9,<F←E>)
45200	ENT(21,<IF((F-B)∧∞)>,,20)
45300	ENT(,<IF((F-C)∧∞)>,,20)
45400	ENT(,<FREEF>)
45500	ENT(20,<F←NPF>,21,22)
45600	ENT(22,<IFB>,,23)
45700	ENT(,<NEW←(@EB∨∃400000,)>)
45800	ENT(23,<IFC>,,24)
45900	ENT(,<NEW←@EC>,24)
46000	ENT(15,<NEW←@EE>)
46100	ENT(24,<A←NDA>,14)
46200	ENT(,<A←NNA>,,28)
46300	ENT(,SETN,26)
46350	ENT(28,<NEW←0,>)
46400	ENT(,SETN)
46500	ENT(,DONE,15,15,15)
46600	
46700	TNAM(RT)
46800	RT:
46900	ENT(1,<A←TNA>)
47000	ENT(,<B←A>)
47100	ENT(4,<IF@DB>,,5)
47200	ENT(,<IF@EB>,5)
47300	ENT(,<C←NPB>,,2)
47400	ENT(,<IF(@PB∧∃400000,)>,3,,3)
47500	ENT(,<RTEB,C>)
47600	ENT(3,<FREEB>)
47700	ENT(,<B←NPB>,4,2)
47800	ENT(2,FREEB)
47900	ENT(6,<A←NNA>,1)
48000	ENT(,DONE,2,2,2)
48100	ENT(5,<B←NPB>,4,6,2)
48200	
48300	
     

00100	BEGIN MAIN
00200	↑ROUTE:	MOVE T,NODPNT	;GET POINTER TO NODE TABLE
00300	COMMENT ∞
00400		SETZM NINON
00500	LOOP4:	HLRE SS,(T)	;GET LEFT HALF OF FIRST ENTRY
00600		JUMPG SS,PNT1	;NO0 OR -1?
00700		SKIPN (T)	;ZERO?
00800		JRST DON1	;YES
00900		AOJA T,LOOP4
01000	PNT1:	HLLZ A2,(T)	;GET THE PINS IN THIS DIP IN THIS  NODE
01100		MOVE SS,T
01200	LOOP2:	MOVE A3,(T)	;GET DIP
01300		XOR A3,A2
01400		TLNN A3,1777	;SAME DIP?
01500		AOJA T,LOOP2	;YES
01600		MOVE DD,T
01700		SUB DD,SS	;FORM DIF. (COUNT)
01800		SKIPN D,NINON	;DO WE HAVE AN INON?
01900		MOVE D,SS	;NO, USE FIRST
02000		MOVEM D,INON
02100		TLNN A3,1740	;IS NEXT DIP IN SAME COLUMN?
02200		JRST PNT2	;YES
02300	PNT10:	MOVEI A6,-1(T)	;NO, GET LAST ENTRY FOR THIS DIP
02400		SETZM NINON
02500		JSR FNDON	;TRY IT AS OUTON
02600		MOVEI A6,-2(T)	;NOT GOOD, TRY THIS
02700		JSR FNDON
02800		JRST 4,.
02900	PNT2:	MOVE A4,SS
03000		MOVE A5,T
03100		MOVSI A1,1	;INITIAL DIFF
03200		HLLZ C,(A5)	;GET DIP # OF NEXT DIP
03300	PNT6:	HRRZ A2,(A4)	;GET PIN #S
03400		HRRZ A3,(A5)
03500		SUB A2,A3
03600		MOVMS A2	;GET DIF.
03700		CAMGE A1,A2	;IS DIF SMALLER THAN OLD DIF?
03800		JRST PNT4	;NO
03900		JUMPN A2,PNT5	;IS DIF 0??
04000		MOVEM A4,A4SAV#	;NO, SAVE POINTERS
04100		MOVEM A5,A5SAV#
04200		MOVE A1,A2	;GET NEW DIF.
04300		JRST PNT4
04400	PNT5:	TRNE A3,1	;ODD OR EVEN PIN?
04500		JRST PNT7	;ODD, NOTHING SPECIAL
04600		MOVE A2,1(A5)	;GET NEXT ENTRY IN NEXT DIP
04700		CAIE A3,-1(A2)	;IS IT NEXT PIN #?
04800		JRST PNT7	;NO
04900		XOR A2,C	;YES, IS IT REALLY NEXT DIP?
05000		TLNE A2,1777	;?
05100		JRST PNT7	;NO
05200		ADDI A5,1	;YES, WE WANT THIS
05300		MOVEM A5,NINON	;SET NEW INON
05400		MOVE A6,A4
05500		JSR FNDON
05600		SUBI A5,1	;SORRY, CAN'T DO IT
05700	PNT4:	HRRZ A2,(A4)	;GET PIN #
05800		CAML A2,A3	;SEE WHICH IS LARGER AND INCREMENT OTHER
05900		JRST PNT8
06000		ADDI A4,1	;INCR. THIS ONE
06100		CAME A4,T	;DONE?
06200		JRST PNT6	;NO
06300	PNT9:	MOVE A5,A5SAV	;DONE
06400		MOVEM A5,NINON
06500		MOVE A6,A4SAV
06600		JSR FNDON	;IS THIS AN OK OUTON??
06700		JRST PNT10	;NO
06800	PNT8:	ADDI A5,1	;INCR. NEXT ONE
06900		MOVE A2,(A5)	;GET ENTRY
07000		XOR A2,C
07100		TLNN A2,1777	;SAME DIP?
07200		JRST PNT6	;YES, PROCEED
07300		JRST PNT9	;NO
07400	PNT7:	MOVEM A5,NINON
07500		MOVE A6,A4
07600		JSR FNDON
07700		JRST PNT4
07800	FNDON:	0
07900		CAIN DD,1	;IS THERE ONLY 1 PIN?
08000		JRST PNT3	;YES, IT'S OK
08100		CAME A6,INON	;SAME AS INON PIN?
08200		JRST PNT3	;NO, IT'S OK
08300		CAIE DD,2	;ONLY 2 PINS?
08400		JRST @FNDON	;NO, NOT OK
08500		MOVE A5,(SS)	;YES, GET 1
08600		SUB A5,1(SS)	;SUB OTHER
08700		MOVMS A5
08800		CAILE A5,2	;ARE THEY IN A GROUP?
08900		JRST @FNDON	;NO, NOT OK
09000	PNT3:	MOVEM A6,OUTON	;YES, OK
09100		CAIN DD,1	;ONLY 1 PIN?
09200		JRST ARN	;YES, SKIP ALL THIS OTHER SHIT
09300	;NOW LINK UP GROUPS (DIFS 1 OR 2)
09400		MOVE A1,SS	;GET START
09500	DO3:	HLLZ C,(A1)	;GET DIP #
09600		HRRZ A2,(A1)	;GET PIN #
09700		MOVE A3,1(A1)	;GET NEXT ENTRY
09800		XOR A3,C	;SAME DIP?
09900		TLNE A3,1777	;?
10000		MOVEI A3,77	;NO, MAKE PIN # LARGE
10100		SUB A3,A2	;PIN # DIF
10200		CAIN A3,2	;IS DIF 2?
10300		JRST DO2	;YES
10400		CAIN A3,1	;NO, IS IT 1?
10500		JRST DO1	;YES
10600		JRST PNT20	;NO, DONE
10700	DO1:	MOVE A3,2(A1)	;GET NEXT NEXT PIN
10800		XOR A3,C	;SAME DIP?
10900		TLNE A3,1777	;?
11000		MOVEI A3,77	;NO
11100		SUB A3,A2	;GET PIN # DIF.
11200		CAIE A3,2	;IS IT 2?
11300		JRST DO2	;NO, DO THE TWO PIN NEXT TO EACH OTHER
11400		PUSH P,SS	;YES, SAVE SOME THINGS
11500		PUSH P,DD
11600		PUSH P,A1
11700		PUSH P,T
11800		MOVE SS,2(A1)
11900	DO4:	MOVE DD,(A1)
12000		PUSHJ P,RTIT	;ROUTE THESE TWO
12100		POP P,T
12200		POP P,A1
12300		POP P,DD
12400		POP P,SS
12500		ADDI A1,1
12600		JRST DO3
12700	DO2:	PUSH P,SS	;SAVE
12800		PUSH P,DD
12900		PUSH P,A1
13000		PUSH P,T
13100		MOVE SS,1(A1)	;DO THE TWO NEXT EACH OTHER
13200		JRST DO4
13300	RTIT:	PUSHJ P,FNUM	;GET BRANCH #
13400		MOVE T,DISTAB(F)
13500		PUSHJ P,(T)
13600		POPJ P,
13700	PNT20:	MOVE A3,1(A1)
13800		XOR A3,C
13900		TLNN A3,1777
14000		AOJA A1,DO3
14100	;NOW RE-ORDER THE NODE
14200		MOVE E,OUTON	;GET OUT PIN
14300		MOVE F,(E)	;GET ENTRY
14400		MOVE A1,INON	;GET IN PIN
14500		MOVEI A2,
14600		MOVE C,(A1)	;GET IN PIN ENTRY
14700		MOVEM C,NST(A2)	;DEPOSIT AS FIRST ENTRY
14800		HRRZ D,1(A1)
14900		SUBI D,(C)	;GET DIFF TO NEXT PIN
15000		CAILE D,2	;IS IT IN GROUP?
15100		JRST PNT21	;NO
15200		CAIN T,1(A1)	;YES, IS IT IN THIS DIP?
15300		JRST PNT21	;NO
15400		MOVE C,1(A1)	;YES,GET IT
15500	PNT24:	MOVEM C,NST+1(A2);AND DEPOSIT
15600		MOVEI C,400000	;MARK AS ALREADY WIRED WITHIN GROUP
15700		ORM C,NST(A2)	;...
15800		ADDI A2,2	;GO TO NEXT PLACE IN DEST TABLE
15900		PUSHJ P,CLRT	;CLEAR OUT THIS GROUP
16000		JRST PNT22
16100	CLRT:	CAMN A1,SS
16200		JRST CLRN
16300		SUBI A1,1
16400		MOVE C,1(A1)
16500		SUB C,(A1)
16600		CAIG C,2
16700		JRST CLRT
16800		ADDI A1,1
16900	CLRN:	MOVE C,(A1)
17000		SETZM (A1)
17100		ADDI A1,1
17200		MOVE D,(A1)
17300		SUB D,C
17400		CAIN D,2
17500		JRST CLRN
17600		CAIN D,1
17700		JRST CLRN
17800		POPJ P,
17900	PNT21:	CAIN SS,(A1)	;ARE WE AT TOP (FIRST ENTRY FOR DIP)
18000		JRST PNT23	;YES, ONLY ONE PIN IN THIS GROUP
18100		SUB C,-1(A1)	;NO, GET PREV. ENTRY DIF.
18200		CAILE C,2	;IS IT IN GROUP?
18300		JRST PNT23	;NO, ONLY 1 IN GROUP
18400		MOVE C,-1(A1)	;GET PREV ENTRY
18500		JRST PNT24
18600	PNT23:	ADDI A2,1
18700		PUSHJ P,CLRT
18800	PNT22:	MOVE A1,SS	;GET START OF DIP ENTRIES
18900	PNT31:	SKIPN C,(A1)	;GET ENTRY
19000		JRST PNT30	;ZERO, SKIP IT
19100		MOVEM C,NST(A2)	;DEPOSIT IN DEST TABLE
19200		PUSHJ P,CLRN	;CLEAR THIS GROUP AND GET LAST ENTRY
19300		CAMN C,NST(A2)	;SAME AS FIRST?
19400		AOJA A2,PNT32	;YES, DON'T DEPOSIT
19500		MOVEM C,NST+1(A2);NO, DEPOSIT
19600		MOVEI C,400000	;MARK PREV. AS DONE
19700		ORM C,NST(A2)	;...
19800		ADDI A2,2
19900		JRST PNT32
20000	PNT30:	ADDI A1,1
20100	PNT32:	CAMGE A1,T	;DONE?
20200		JRST PNT31	;NO
20300		CAIGE A2,(DD)	;IS DEST TABLE FULL?
20400		JRST ARN2	;NO
20500		MOVE D,NST-2(DD);YES, GET NEXT TO LAST ENTRY
20600		TRNE D,400000	;IS IT DONE?
20700		MOVEM F,NST-1(DD);YES, DEPOSIT OUT PIN AS LAST
20800		JRST ARN1
20900	ARN2:	MOVEI C,400000
21000		OR C,NST-1(A2)
21100		MOVEM C,NST-1(A2);MARK LAST ONE THERE AS DONE
21200		ADDI A2,1
21300		CAME A2,DD
21400		JRST ARN2+2
21500		MOVEM F,NST-1(DD);DEPOSIT OUT PIN
21600	ARN1:	HRLI SS,NST
21700		BLT SS,-1(T)	;BLT NEWLY ORDERED ENTRIES BACK
21800	ARN:	SKIPE (T)	;NEXT ENTRY 0?
21900		JRST PNT1	;NO, DO IT
22000	DON1:	SETZM NINON
22100		SKIPE 1(T)
22200		AOJA T,LOOP4
22300	∞
22400		PUSHJ P,NDCNT
22500		MOVEM C,NCSAV
22600		SETZM SNCNT
22700		MOVEI T,GP
22800		PUSHJ P,SLDO
22900		PUSHJ P,NDCNT
23000		MOVEM C,NNCSAV
23100		MOVE T,NODPNT	;GET NODE POINTER
23200	LOOP6:	HLRE SS,(T)
23300		JUMPG SS,PNQ1
23400		SKIPN (T)
23500		JRST DON21
23600		AOJA T,LOOP6
23700	PNQ1:	MOVEI A1,
23800	LOOP8:	MOVS C,(T)	;GET FIRST ENTRY OF COL.
23900		MOVEM T,NST(A1)	;DEPOSIT POINTER
24000		ANDI C,37	;GET ROW
24100		MOVEM C,NST+1(A1);DEPOSIT IT
24200		HLRZ D,(T)	;GET DIP #
24300		ADDI T,1
24400	LOOP7:	MOVS C,(T)	;GET NEXT ENTRY
24500		XOR C,D
24600		TRNN C,1740	;SAME COLUMN?
24700		AOJA T,LOOP7	;YES
24800		MOVS C,-1(T)	;NO, GET ENTRY BEFORE
24900		ANDI C,37	;GET ROW
25000		HRLM C,NST+1(A1);DEPOSIT
25100		MOVEI D,-1(T)
25200		HRLM D,NST(A1)	;DEPOSIT POINTER TO END
25300		ADDI A1,2
25400		SKIPE (T)	;END OF NODE?
25500		JRST LOOP8	;NO
25600		CAIG A1,2	;ONLY ONE COL?
25700		JRST PNQ2	;YES, QUIT
25800		MOVEI C,
25900	  DEFINE FOO1 (ARG)
26000	{	HRRZ A3,NST+1(ARG)
26100		HLRZ A4,NST+1(ARG)
26200		HRRZ A5,NST+3(ARG)
26300		HLRZ A6,NST+3(ARG)
26400		FOR I IN (<A3,A5,1>,<A3,A6,2>,<A4,A5,4>,<A4,A6,10>)
26500	{	FOO (I)
26600	}
26700	}
26800	  DEFINE FOO (A,B,D)
26900	{	CAML A,B
27000		TRO C,D}
27100		FOO1(0)
27200		MOVE D,NST	;GET FIRST COL.
27300		SETZM RSW#	;CLEAR "REVERSED" SWITCH
27400		MOVE C,TB1(C)	;GET RESULT OF CODE
27500		JRST .+1(C)	;REVERSE THE THINGS TO REVERSE
27600		PUSHJ P,REV	;0--REVERSE BOTH
27700		MOVE D,NST+2	;1--REVERSE SECOND
27800		SETOM RSW
27900		PUSHJ P,REV	;3--REVERSE FIRST
28000		MOVEI A2,2	;4--NEITHER
28100		CAIG A1,2(A2)	;DONE?
28200		JRST PNQ2	;YES
28300	LOOP9:	MOVEI C,
28400		FOO1(A2)
28500		MOVE D,NST+2(A2);GET POINTER TO THING TO REVERSE
28600		SKIPE RSW	;THIS ONE REVESED?
28700		JRST PNQ4	;YES
28800		SETZM RSW
28900		SKIPE TB2(C)	;DO WE REVERSE?
29000		PUSHJ P,REV1	;YES
29100		JRST PNQ5
29200	PNQ4:	SETZM RSW
29300		SKIPN TB2(C)
29400		PUSHJ P,REV1
29500	PNQ5:	ADDI A2,2
29600		CAILE A1,2(A2)
29700		JRST LOOP9
29800	PNQ2:
29900	DON21:	SKIPE 1(T)
30000		AOJA T,LOOP6
30100	
30150	COMMENT ∞
30200		MOVE T,NODPNT
30300	LOOP1:	HLRE SS,(T)	;GET LEFT HALF OF FIRST ENTRY
30400		JUMPG SS,PNT11	;NOT 0 OR -1?
30500		SKIPN (T)	;ZERO?
30600		JRST DON11	;YES
30700		AOJA T,LOOP1
30800	PNT11:	SKIPN 1(T)
30900		JRST DON2
31000		MOVE DD,(T)	;GET FIRST AS DEST
31100		MOVE SS,1(T)	;GET SECOND AS SRC.
31200		TRNE DD,400000	;DONE?
31300		JRST PNTT	;YES
31400		TRZ DD,700000
31500		TRZ SS,700000
31600		CAMGE SS,DD
31700		EXCH SS,DD
31800		PUSHJ P,FNUM	;GET NUM
31900		PUSH P,T	;SAVE POINTER
32000		MOVE T,DISTAB(F);GET DISPATCH ENTRY
32100		PUSHJ P,(T)
32200		POP P,T
32300	PNTT:	HLRZ SS,1(T)	
32400		AOJA T,PNT11
32500	DON2:	ADDI T,1
32600	DON11:	SKIPE 1(T)
32700		AOJA T,LOOP1;∞
32710	
32720		MOVEI T,RT
32730		PUSHJ P,SLDO
32740	
32800	;DO FIRST PART OF CE PINS
32900		MOVE T,NODPNT
33000		SETOM CECNT
33100	RNT3:	HLRE SS,(T)
33200		JUMPG SS,RNT1
33300		SKIPN (T)
33400		JRST RNT11
33500	RNT2:	SKIPN DD,1(T)
33600		JRST RNT12
33700		HLRE DD,DD
33800		JUMPLE DD,[AOJA T,RNT2]
33900		SKIPGE DD,(T)
34000		JRST RNT12
34100		MOVE SS,1(T)
34200		TRZ SS,600000
34300		PUSH P,T
34400		MOVEI T,CEA
34500		PUSHJ P,CMDO
34600		JFCL
34700		MOVEI SS,177
34800		ANDM SS,STAR+1
34900		MOVE SS,STAR
35000		LSH SS,11
35100		OR SS,STAR+1
35200		HRL DD,SS
35300		AOS SS,CECNT
35400		MOVEM DD,CEPINS(SS)
35500		POP P,T
35600	RNT1:	ADDI T,1
35700	RNT12:	SKIPE (T)
35800		AOJA T,.-1
35900		AOJA T,RNT3
36000	RNT11:
36100		POPJ P,
36200	
36300	REV1:	SETOM RSW
36400	REV:	HRRZ A3,D
36500		HLRZ A4,D
36600	RLOP1:	MOVE A5,(A3)
36700		EXCH A5,(A4)
36800		MOVEM A5,(A3)
36900		ADDI A3,1
37000		SUBI A4,1
37100		CAMGE A3,A4
37200		JRST RLOP1
37300		HRRZ A3,D
37400		HLRZ A4,D
37500		MOVEI A5,400000
37600	RLOP2:	ANDCAM A5,(A3)
37700		TDNE A5,1(A3)
37800		ORM A5,(A3)
37900		CAIGE A3,-1(A4)
38000		AOJA A3,RLOP2
38100		ANDCAM A5,(A4)
38200		POPJ P,
38300	
38400	TB1:	4↔4↔4↔4
38500		3↔3↔4↔4
38600		4↔4↔4↔4
38700		3↔1↔4↔0
38800	TB2:	0↔0↔0↔0
38900		1↔1↔0↔0
39000		0↔0↔0↔0
39100		1↔1↔0↔0
39200	
39300	
39400	↑REG:	HLRZS T	;GET POINTR TO TABLE
39500		PUSHJ P,CMDO
39600		JFCL	;FAIL?
39700		POPJ P,
39800	
39900	↑REASY:	TRNN DD,1	;GET ODD # IN B
40000		EXCH SS,DD	;...
40100		HLRZ C,SS	;GET LOCATION OF DIP
40200		HLRZ D,TYPPNT(C);GET "STRAIGHT" TABLE
40300		MOVSI A1,400000
40400		ORM A1,(D)	;MARK THAT AN ENTRY IS HERE
40500		HRRZ A1,DD	;GET ODD PIN #
40600		MOVEI A2,1
40700		LSH A2,(A1)	;FORM CORRECT BIT
40800		ORM A2,1(D)	;OR IT IN
40900		POPJ P,
41000	↑NEASY:	TRNN DD,1	;GET ODD # IN DD
41100		EXCH SS,DD	;...
41200		HLRZ C,SS	;GET LOCATION OF DIP
41300		HRRZ D,TYPPNT(C);GET "REGULAR" TABLE
41400		HRRZ A1,SS	;GET EVEN PIN #
41500		MOVEI A2,1
41600		LSH A2,(A1)	;GET CORRECT BIT
41700		ORM A2,1(D)	;OR IT IN FOR ZIG RIGHT OF EVEN PIN
41800		MOVSI T,NES	;TABLE FOR REST OF IT
41900		JRST REG	;DO THE REST
42000	↑XEASY:	HLRZ C,SS	;GET DIP LOC
42100		MOVE D,TYPPNT(C);GET TABLE
42200		HRRZ A1,SS	;GET PIN #
42300		HRRZ F,DD	;GET PIN #
42400		CAML A1,F	;SMALLER IN A1
42500		EXCH A1,F
42600		MOVEI A2,1
42700		LSH A2,(A1)	;GET CORRECT BIT
42800		ORM A2,2(D)	;OR IT IN
42900		POPJ P,
43000	↑DO12:	TRNN SS,1	;IS SOURCE (BOTTOM DIP) PIN ODD (TOP ROW)
43100		JRST D1H	;NO, DO IT HARD WAY
43200		MOVEI T,DUA	;TRY EXTRA EASY WAY
43300		PUSHJ P,CMDO
43400		JRST DO13	;FAIL, TRY 13'S WAY
43500		POPJ P,
43600	↑DO13:	TRNN SS,1	;IS SOURCE PIN ODD?
43700		JRST D1H	;NO
43800		MOVEI T,DUB	;TRY SORT-OF EASY WAY
43900		PUSHJ P,CMDO
44000		SKIPA		;FAIL
44100		POPJ P,
44200	DOVER:	MOVSI T,VER	;DO IT THE LONG SAFE WAY
44300		JRST REG
44400	↑D1H:	MOVEI T,DUC	;TRY THE DIRTY WAY
44500		PUSHJ P,CMDO	;...
44600		JRST DOVER	;NO
44700		POPJ P,
44800	
44900	↑CROUTE:MOVEI T,
45000	CRLP2:	CAMLE T,CECNT
45100		POPJ P,
45200		LDB C,[POINT 5,CEPINS(T),8]
45300		LDB D,[POINT 7,CEPINS(T),17]
45400		TRNE D,100
45500		OR D,[XWD -1,777700]
45600		ADD D,HPOS(C)
45700		SUB D,YOFF
45800		MOVEI C,
45900	CRLP1:	HLRE E,PINT1(C)
46000		CAMG D,E
46100		JRST .+3
46200		CAIGE C,=143
46300		AOJA C,CRLP1
46400		SKIPN PINT2(C)
46500		JRST CRFND
46600		SOJGE C,.-2
46700		ADDI C,1
46800		SKIPE PINT2(C)
46900		AOJA C,.-1
47000	CRFND:	HRRZ D,CEPINS(T)
47100		MOVEM D,PINT2(C)
47200		LDB SS,[POINT 5,CEPINS(T),8]
47300		MOVSS SS
47400		HLR SS,CEPINS(T)
47500		TRZ SS,777600
47600		HLRE D,PINT1(C)
47700		ADD D,YOFF
47800		MOVEI E,1
47900		CAMG D,HPOS(E)
48000		JRST .+3
48100		CAIGE E,23
48200		AOJA E,.-3
48300		HRLZ DD,E
48400		SUB D,HPOS(E)
48500		HRR DD,D
48600		MOVE D,PINT1(C)
48700		ANDI D,3
48800		DPB D,[POINT 2,DD,12]
48900		PUSH P,T
49000		MOVEI T,CEB
49100		PUSHJ P,CMDO
49200		JFCL
49300		POP P,T
49400		AOJA T,CRLP2
49500	
49600	  DEFINE RET
49700	{	HLRE T,NPSAV
49800		JUMPG T,MRET
49900		JUMPL T,CMFAIL
50000		JRST CMDONE}
50100	  DEFINE FORM1 (A,B,C)
50200	{	LDB C,[POINT 7,B,35]
50300		DPB A,[POINT 5,C,28]}
50400	  DEFINE FORM2 (A,B,C)
50500	{	LDB C,[POINT 7,B,35]
50600		DPB A,[POINT 5,C,26]
50700		TRNN C,100
50800		TRO C,200}
50900	  DEFINE SETUP (A)
51000	{	ANDI A,37177
51100		TRNN A,100
51200		TRO A,200}
51300	  DEFINE DOBLT (A)
51400	{	MOVE A,[A1,,A1S]
51500		BLT A,A6S}
51600	  DEFINE FOO 3(A,B)
51700	{	DEFINE C$3A  {B}}
51800	  DEFINE FO (A,B)
51900	{FOO(→"A",B)}
52000	
52100	FO (<←>,CLA)
52200	FO (<↑>,CUA)
52300	FO (M,CM)
52400	FO (P,CMP)
52500	FO (D,CMD)
52600	FO (T,CMT)
52700	FO (E,CMEVEN)
52800	FO (U,CMU)
52900	FO(<[>,ZIGR)
53000	FO(<]>,ZIGL)
53100	FO(C,CMCALL)
53200	FO(R,CMRET)
53300	FO(S,CMSTO)
53400	FO(F,CMFIND)
53500	FO(B,CMBRK)
53600	FO(≡,CMCLOS)
53700	FO(¬,CMPOP)
53800	FO(I,CMDIN)
53900	FO(X,CMXCT)
54000	FO(<↓>,CMDAST)
54100	FOO(0,EXWRD)
54200	
54300	
54400	CMTAB:	FOR @5 I←0,177
54500	{IFDEF C$5I,<C$5I;>0
54600	}
54700	
54800	DEFINE FOO 3(A,B)
54900	{DEFINE A$3A  {B}}
55000	
55100	FO( ,CPOPJ)
55200	FO(S,ARSRC)
55300	FO(D,ARDST)
55400	FO(<∞>,ARINF)
55500	FO(+,ARG1+1)
55600	FO(-,ARMINS)
55700	FO(<↔>,ARBWAR)
55800	FO(I,AINC)
55900	FO(A,AARG)
56000	FOR I←0,7
56100	{FO(I,ADIG)
56200	}
56300	FO(8,ADIG)
56400	FO(9,ADIG)
56500	FO(T,ATAB)
56600	FO(Z,ASIZ)
56700	FO(*,ARGSTA)
56800	FO($,ARGDOL)
56900	FO(%,ARGPER)
57000	FO(<P>,ARGP)
57100	FO(<|>,ARGSIN)
57200	FO(α,ARGALF)
57300	
57400	
57500	AGTAB:	FOR @5 I←0,177
57600	{IFDEF A$5I,<A$5I;>SERR
57700	}
57800	
57900	DEFINE ENQ (L,A,B,C)
58000	{L:	XWD A,B
58100		ASCIZ /C/}
58200	
58300	DEFINE TNAM %(QRN)
58400	{  DEFINE ENT $(L,A,B,C,FOO)
58500	{QRN%$L:	XWD QRN%$A,QRN%$B
58600	IFDIF <FOO>,<>,<FOO;>
58700		ASCIZ /C/}
58800	QRN%777←←-1
58900	QRN%0←←0
59000	}
59100	
59200	 TNAM (HW)
59300	
59400	HW:
59500	ENT(100,101,,<S%      >)
59600	ENT(101,102,,<↓$4P>)
59700	ENT(102,103,106,<F$3%3%1%4  >)
59800	ENT(103,104,106,<≡%5%6*3*4*5*6>)
59900	ENT(104,200,204,<T*5%5>)
60000	ENT(200,201,,<U-*6     >)
60100	ENT(201,202,,<UI%6     >)
60200	ENT(202,205,204,<TA1|$1-1,>)
60300	ENT(205,206,,<U*1*2*5*6%5%6>)
60400	ENT(206,114,,<U     I-$1>)
60500	ENT(204,114,,<U*1*2*5*6%5%6>)
60600	ENT(114,115,106,<←   I-$2  >)
60700	ENT(115,105,,<↓$52,>)
60800	ENT(105,106,,<CRS   *6 %6>)
60900	ENT(106,107,,SP$4)
61000	ENT(107,112,,<U$1$2$3$4$5%2>)
61100	ENT(112,113,,<S$     I-6,>)
61200	ENT(113,108,,<U%1%2%3%4%5%6>)
61300	ENT(108,110,111,EA4)
61400	ENT(111,110,,<U   I-1,  >)
61500	ENT(110,120,121,<← I-1,    >)
61600	ENT(121,130,122,<TA2$6>)
61700	ENT(122,123,130,<←    A3A4>)
61800	ENT(123,124,,<IM←4,0,     I-$1>)
61900	ENT(124,224,,<U     I-$1,>)
62000	ENT(224,210,,<IM↑8,8,A5A60,0,0,0,>)
62100	ENT(210,110,,<U   I-$1%5%6>)
62200	ENT(120,125,,<↓$54,>)
62300	ENT(125,225,,<↓α1P>)
62400	ENT(225,230,,<CRS      >)
62500	ENT(230,121,,<SPα1>)
62600	ENT(130,131,,SP$4)
62700	ENT(131,132,,<U$1$2$3$4$5%2>)
62800	ENT(132,133,,<S$     I+6,>)
62900	ENT(133,134,,<U%1%2%3%4%5%6>)
63000	ENT(134,135,136,<EA4>)
63100	ENT(136,135,,<U   I-1,  >)
63200	ENT(135,137,138,<← I1,    >)
63300	
63400	ENT(138,150,139,<TA2$6>)
63500	ENT(139,140,150,<←    A3A4>)
63600	ENT(140,141,,<IM←5,0,     I-$1>)
63700	ENT(141,241,,<U     I-$1,>)
63800	ENT(241,235,,<IM↑8,8,A5A60,0,0,0,>)
63900	ENT(235,135,,<U   I-$1%5%6>)
64000	ENT(137,188,,<↓$55,>)
64100	ENT(188,288,,<↓α1P>)
64200	ENT(288,250,,<CRS      >)
64300	ENT(250,138,,<SPα1>)
64400	
64500	ENT(150,155,,SP$4)
64600	ENT(155,151,152,<←%1$3%3%4%5%6>)
64700	ENT(152,180,153,<TA2|$3∞>)
64800	ENT(153,151,152,<← I|$31,    >)
64900	ENT(151,154,,<↓$52,>)
65000	ENT(154,156,,<ID|$316,%3%1%4A1A2>)
65100	ENT(156,179,,<CRS      >)
65200	ENT(179,152,,SP$4)
65300	ENT(180,,,<CRF      >)
65400	
65500	
65600	TNAM(LNG)
65700	↑LNG:
65800	
65900	ENT(1,2,3,<T↔R1,1,>)
66000	ENT(2,4,,<U T0ZS    >)
66100	ENT(3,4,,<U T1ZS    >)
66200	ENT(4,5,,<S$1,2,A2 2, >)
66300	ENT(5,6,27,<COSDRSPRSDCSPCDDCDPC>,HW)
66400	ENT(6,8,,<PU>)
66500	ENT(8,10,,<IM←$52,      >)
66600	ENT(10,11,,<UA5A6A1A2DDR↔R∞>)
66700	ENT(11,12,13,<↑    I↔R-1, >)
66800	ENT(13,26,27,<↑   ↔R∞  >)
66900	ENT(12,14,,<D↔R-4,DDCDDRDPC  >)
67000	ENT(14,15,,<M↑0,0,      >)
67100	ENT(15,16,,PO)
67200	ENT(26,17,,PO)
67300	ENT(17,6,27,<CRS      >)
67400	ENT(27,7,,<SP0,>)
67500	ENT(16,0,,X)
67600	ENT(7,31,,<USDCSPCSDR↔R-∞DDR↔R-∞>)
67700	ENT(31,32,33,<↑  I↔R1,   >)
67800	ENT(32,34,35,<T↔R1,1,>)
67900	ENT(34,36,,<U T1ZD    >)
68000	ENT(35,36,,<U T0ZD    >)
68100	ENT(36,37,,<S$-1,-2,A2 2, >)
68200	ENT(37,38,21,<CODDRDPRDDCDPCSDCSPC>,HW)
68300	ENT(38,23,,PU)
68400	ENT(23,40,,<IM←$52,      >)
68500	ENT(40,41,,<UA5A6A1A2SDR↔R-∞>)
68600	ENT(41,42,43,<↑    I↔R1, >)
68700	ENT(43,97,,PO)
68800	ENT(42,39,,<M↑0,0,      >)
68900	ENT(39,44,,<D↔R4,SDCSDRSPC  >)
69000	ENT(44,45,,PO)
69100	ENT(45,0,,X)
69200	ENT(97,38,21,<CRS      >)
69300	ENT(21,33,,<SP0,>)
69400	ENT(33,51,52,<T↔R1,1,>)
69500	ENT(51,53,,<S$1,2,T0ZS 2, >)
69600	ENT(52,53,,<S$1,2,T1ZS 2, >)
69700	ENT(53,54,777,<COSDRSPRSDCSPCDDC∞>,HW)
69800	ENT(54,55,,PU)
69900	ENT(55,56,57,<←     DPC>)
70000	ENT(57,62,59,<TA6∞>)
70100	ENT(59,56,57,<←     I1,>)
70200	ENT(56,60,,PU)
70300	ENT(60,61,58,<↑A5A6A1A2DDR↔R-∞>)
70400	ENT(58,57,,PO)
70500	ENT(62,63,,PO)
70600	ENT(63,54,777,<CRS      >)
70700	ENT(61,81,,<↓*6A2>)
70800	ENT(81,64,,<U%1%2%3%4%5%6>)
70900	ENT(64,65,,PU)
71000	ENT(65,66,,<U$1$2$3$4$5$6>)
71100	ENT(66,67,,PU)
71200	ENT(67,68,69,<T↔R1,1,>)
71300	ENT(68,70,,<S$-1,-2,T1ZD   >)
71400	ENT(69,70,,<S$-1,-2,T0ZD   >)
71500	ENT(70,71,72,<CODDRDPRDDCDPCDDC*6>,HW)
71600	ENT(72,73,,PO)
71700	ENT(73,74,,<S$      >)
71800	ENT(74,75,,PO)
71900	ENT(75,58,,<S%      >)
72000	ENT(71,76,,PU)
72100	ENT(76,78,77,<↑A5A6A1A2DDR↔R-∞>)
72200	ENT(77,72,,PO)
72300	ENT(78,79,,<↓*6A4>)
72400	ENT(79,80,,PO)
72500	ENT(80,82,,<M←$52,      >)
72600	ENT(82,88,,PO)
72700	ENT(88,83,,<↓$5A5>)
72800	ENT(83,84,,PO)
72900	ENT(84,87,,PO)
73000	ENT(86,89,,PO)
73100	ENT(87,85,,<M←$52,      >)
73200	ENT(85,86,,<M↑0,0,A5A6A1A2DDR*6>)
73300	ENT(89,90,,PO)
73400	ENT(90,0,,X)
73500	
73600	
73700	TNAM(R10)
73800	↑R10:
73900	ENT(77,1,2,<T↔R1,1,>)
74000	ENT(1,3,,<D↔R16,SDCSDRSPCSDR↔R∞>)
74100	ENT(3,0,,<D↔R-4,DDCDDRDPCSDR↔R∞>)
74200	ENT(2,4,,<D↔R4,SDCSDRSPCSDR↔R∞>)
74300	ENT(4,0,,<D↔R-16,DDCDDRDPCSDR↔R∞>)
74400	
74500	TNAM(NES)
74600	↑NES:
74700	ENT(1,0,,<D0,DDCDDRDPCDDRSPR>)
74800	
74900	TNAM(HOR)
75000	↑HOR:
75100	ENT(1,2,3,<F-1,SDCSDRSPC  >)
75200	ENT(3,4,5,<F-1,DDCDDRDPC  >)
75300	ENT(15,6,7,<←SDRT1ZSSDCSPCDDCDPC>)
75400	ENT(7,6,7,<← I-1,    >)
75500	ENT(6,8,,<M←2,2,      >)
75600	ENT(8,9,,<D-16,DDCDDRDPCA1A2>)
75700	ENT(9,0,,<D-16,SDCSDRSPCA1A2>)
75800	ENT(2,10,3,<≡DDCDPC*3*4*5*6>)
75900	ENT(10,13,,<U*1*2A1A2*5*6>)
76000	ENT(13,14,16,<←     I-2,>)
76100	ENT(16,14,3,<←     I4,>)
76200	ENT(14,11,,<M←2,2,     *6>)
76300	ENT(11,0,,<D-16,DDCDDRDPCA1A2>)
76400	ENT(4,12,5,<≡SDCSPC*3*4*5*6>)
76500	ENT(12,17,,<U*1*2A1A2*5*6>)
76600	ENT(17,18,19,<←     I-2,>)
76700	ENT(19,18,5,<←     I4,>)
76800	ENT(18,9,,<M←2,2,     *6>)
76900	ENT(5,35,15,<TSPRDPR>)
77000	;ENT(35,41,,<USDRSPRSDCSPCDDCDPC>)
77100	;ENT(41,21,42,<ESPC>)
77200	;ENT(42,21,,<U   I-1, I-1,>)
77300	;ENT(21,22,23,<← I-1,    >)
77400	;ENT(23,24,15,<← I2,    >)
77500	;ENT(22,0,,<M←4,4,      >)
77600	;ENT(24,0,,<M←5,5,      >)
77700	ENT(35,36,,<USPR     >)
77800	ENT(36,37,,<S*I-4,-1,-2,4,  >)
77900	ENT(37,38,,<SP0,>)
78000	ENT(38,39,,<USDRSPRSDCSPCDDCDPC>)
78100	ENT(39,69,68,<ESPC>)
78200	ENT(68,69,,<U   I-1, I-1,>)
78300	ENT(69,40,41,<← I*2    >)
78400	ENT(41,43,42,<TA2*1>)
78500	ENT(42,44,,<S%      >)
78600	ENT(44,45,43,<←    A3A4>)
78700	ENT(45,146,43,<←  %5%6%5%6>)
78800	ENT(146,46,,<U   I1,  >)
78900	ENT(46,147,,<IM←0,*4      >)
79000	ENT(147,47,,<IM↑8,8,A3A40,0,0,0,>)
79100	ENT(47,148,,<U  %3%4%3%4>)
79200	ENT(148,48,,<U     I-1,>)
79300	ENT(48,149,,<IM←*40,      >)
79400	ENT(149,49,,<IM↑8,8,A5A60,0,0,0,>)
79500	ENT(49,50,,<U   I-1,%5%6>)
79600	ENT(50,69,,<U     I1,>)
79700	ENT(40,51,,<M←*4*4      >)
79800	ENT(51,0,,X)
79900	ENT(43,52,53,<T*21,>)
80000	ENT(53,54,,<USPR     >)
80100	ENT(54,37,,<S*I4,1,2,5,  >)
80200	ENT(52,15,,<SP0,>)
80300	
80400	
80500	TNAM(DUA)
80600	↑DUA:
80700	ENT(1,2,,<UDDCDPCSDRSPRSDR-∞>)
80800	ENT(2,3,777,<↑   I-5,  >)
80900	ENT(3,4,,<M↑0,0,   SPR  >)
81000	ENT(4,0,,<D0,DDCDDRDPC  >)
81100	TNAM(DUB)
81200	↑DUB:
81300	ENT(1,2,,<USDCSPCDDRDPRDDR∞>)
81400	ENT(2,3,777,<↑   I2,  >)
81500	ENT(3,4,,<M↑0,0,   DPR  >)
81600	ENT(4,5,,<D-4,SDCSDRSPC  >)
81700	ENT(5,7,6,<T↔C1,1,>)
81800	ENT(6,0,,<]DDCDDRDPC   >)
81900	ENT(7,0,,<[DDCDDRDPC   >)
82000	
82100	TNAM(DUC)
82200	↑DUC:
82300	ENT(1,2,777,<↑SDCDPCSDR-∞SDRSPR>)
82400	ENT(2,4,,<M↑0,0,      >)
82500	ENT(4,5,,<D4,A1DDRA2A3A4>)
82600	ENT(5,6,7,<T↔C1,1,>)
82700	ENT(6,0,,<] A3SPC   >)
82800	ENT(7,0,,<[ A3SPC   >)
82900	
83000	
83100	TNAM(VER)
83200	↑VER:
83300	ENT(1,2,,<USDCSPCSDR∞DDR∞>)
83400	ENT(2,3,8,<↑  I-1,   >)
83500	ENT(3,5,7,<↑     T0ZD>)
83600	ENT(6,5,7,<↑     I1,>)
83700	ENT(7,8,6,TA6∞)
83800	ENT(5,9,,PU)
83900	ENT(9,10,11,<←A5A6A1A2DDCDPC>)
84000	ENT(11,7,,PO)
84100	ENT(10,12,,<D0,DDCDDRDPCA1A2>)
84200	ENT(12,13,,<M←2,2,      >)
84300	ENT(13,14,,PO)
84400	ENT(14,15,,<M↑0,0,      >)
84500	ENT(15,0,,<D-16,SDCSDRSPCA3A4>)
84600	ENT(8,40,,<UDDCDPCDDR-∞SDR-∞>)
84700	ENT(40,41,19,<↑  I1,   >)
84800	ENT(41,42,43,<↑     T1ZS>)
84900	ENT(44,42,43,<↑     I-1,>)
85000	ENT(43,19,44,<TA6-∞>)
85100	ENT(42,45,,PU)
85200	ENT(45,46,47,<←A5A6A1A2SDCSPC>)
85300	ENT(47,43,,PO)
85400	ENT(46,48,,<D-16,A5SDRA6A1A2>)
85500	ENT(48,49,,<M←2,2,      >)
85600	ENT(49,50,,PO)
85700	ENT(50,51,,<M↑0,0,      >)
85800	ENT(51,0,,<D0,DDCDDRDPCA3A4>)
85900	COMMENT ⊗
86000	ENT(19,21,,<USDRT1ZSSDCSPCDDCDPC>)
86100	ENT(21,22,23,<←     I↔C-1,>)
86200	ENT(23,21,,<U I-1,   DPC>)
86300	ENT(22,24,,PU)
86400	ENT(24,25,26,<↑A5A6A1A2DDR∞>)
86500	ENT(26,21,,PO)
86600	ENT(25,30,28,<↑     T0ZD>)
86700	ENT(28,26,29,<TA6∞>)
86800	ENT(29,30,28,<↑     I1,>)
86900	ENT(30,31,,PU)
87000	ENT(31,32,33,<←A5A6A1A2DDCDPC>)
87100	ENT(33,28,,PO)
87200	ENT(32,34,,<D16,DDCDDRDPCA1A2>)
87300	ENT(34,35,,<M←2,2,      >)
87400	ENT(35,36,,PO)
87500	ENT(36,37,,<M↑0,0,      >)
87600	ENT(37,38,,PO)
87700	ENT(38,39,,<M←2,2,      >)
87800	ENT(39,0,,<D-16,SDCSDRSPCA1A2>);⊗
87900	
88000	COMMENT ⊗   ⊗
88100	ENT(19,29,,<S$↔C1,↔C2,T1ZS   >)
88200	ENT(29,20,21,<↑SDCSPCSDR-∞DDR∞>)
88300	ENT(21,20,21,<↑ I↔C1,    >)
88400	ENT(20,22,,PU)
88500	ENT(22,24,23,<COSDRSPRSDCSPCA1A2>,HW)
88600	ENT(24,63,,<↓*6A2>)
88700	ENT(63,64,,<IM←$52,      >)
88800	ENT(64,80,,PU)
88900	ENT(80,25,81,<↑A5A6A1A2DDR∞>)
89000	ENT(81,78,,PO)
89100	ENT(25,26,,<U%1%2%3%4%5%6>)
89200	ENT(26,27,,PU)
89300	ENT(27,28,,<U$1$2$3$4$5$6>)
89400	ENT(28,30,,PU)
89500	ENT(30,31,,<U%6     >)
89600	ENT(31,32,,<UI-DPC*6    >)
89700	ENT(32,62,,PU)
89800	ENT(62,33,,<S$|A11,|A12,T0ZD   >)
89900	ENT(33,34,35,<CODDRDPRDDCDPC%5%6>,HW)
90000	ENT(34,36,,<IM←$52,      >)
90100	ENT(36,37,,<S*      >)
90200	ENT(37,65,,PO)
90300	ENT(65,38,,PU)
90400	ENT(38,39,72,<↑*5*6*1*2SDRA2>)
90500	ENT(39,66,,<M↑0,0,      >)
90600	ENT(66,67,,PO)
90700	ENT(67,68,,PO)
90800	ENT(68,69,,PO)
90900	ENT(69,70,,PO)
91000	ENT(70,0,,X)
91100	ENT(72,34,35,<CRS*1*2*3*4*5*6>)
91200	ENT(35,71,,PO)
91300	ENT(71,73,,PO)
91400	ENT(73,74,,<S$      >)
91500	ENT(74,75,,PO)
91600	ENT(75,76,,<S%      >)
91700	ENT(76,77,,PO)
91800	ENT(77,78,,<¬>)
91900	ENT(78,24,23,<CRS      >)
92000	ENT(23,21,,PO);⊗
92100	
92200	TNAM(CEA)
92300	↑CEA:
92400	ENT(1,2,3,ESPC)
92500	ENT(2,4,,<S$1,2,T0ZS   >)
92600	ENT(3,4,,<S$1,2,T1ZS   >)
92700	ENT(4,5,777,<COSDRSPRSDCSPC1,-∞>,HW)
92800	ENT(5,6,,<M←$50,     0,>)
92900	ENT(6,7,,<S*      >)
93000	ENT(7,0,,X)
93100	
93200	TNAM(CEB)
93300	↑CEB:
93400	ENT(1,5,,<U0,9,SDRSPCDDRDPC>)
93500	ENT(5,6,8,<TSDRDDR>)
93600	ENT(6,7,8,<TSPCA6>)
93700	ENT(8,10,9,<↑      >)
93800	ENT(9,10,9,<↑ I1,    >)
93900	ENT(10,11,,<M↑0,0,      >)
94000	ENT(11,12,13,<TDDC2,>)
94100	ENT(12,14,,<M←2,0,A5A6A1A20,1,>)
94200	ENT(13,14,,<M←2,2,A5A6A1A20,3,>)
94300	ENT(14,15,,<M←0,2,SDRSPC1,0,A3A4>)
94400	ENT(15,0,17,<TDDC2,>)
94500	ENT(17,18,,<U0,3,DDRDPCDDRDPC>)
94600	ENT(18,19,,<M↑0,0,     I-1,>)
94700	ENT(19,0,,<M←2,2,A5A6A1A2A11,>)
94800	ENT(7,20,21,<TDDC2,>)
94900	ENT(20,0,,<M←0,0,SDRSPC1,0,0,1,>)
95000	ENT(21,17,,<M←0,2,SDRSPC1,0,0,3,>)
95100	
     

00100	DEFINE FOO (A,B,C)
00200	{	MOVEI A,B
00300		MOVEM C,D}
00400	FOO (A1,A2,SS)
00500	
00600	
00700	ATTAB:	ATT0	;TABLE 0 IS + STARTING ROW
00800		ATT1	;TABLE 1 IS - STARTING ROW
00900	
01000	
01100	ATT0:	5
01200		5
01300		=8
01400	ATT1:	-7
01500		-7
01600		-=10
01700	
01800	
01900	RGGERR:	JRST 4,.
02000	SERR:	OUTSTR [ASCIZ /STRING ERROR, LOC = /]
02100		PUSH P,A1
02200		PUSH P,A2
02300		HRRZ A1,T
02400		PUSHJ P,SR1
02500		OUTSTR [ASCIZ /
02600	REST OF STRING = /]
02700		LDB A1,T
02800		MOVEI A2,"?"
02900		DPB A2,T
03000		OUTSTR (T)
03100		DPB A1,T
03200		OUTSTR [BYTE (7)15,12]
03300		POP P,A2
03400		POP P,A1
03500		JRST 4,.
03600	SR1:	OUTSTR [ASCIZ /IN AC T/]
03700		POPJ P,
03800	
03900	CMDO:	MOVEM P,CMPSAV#	;SAVE PDL POINTER
04000		MOVE C,[XWD -CPLEN,CPDL-1]
04100		MOVEM C,CALPNT
04200	MRET:	MOVE C,(T)	;GET WIN,,LOSE POINTER
04300		MOVEM C,NPSAV#	;SAVE NEXT POINTER
04400	MR1:	HRLI T,700	;MAKE BYTE POINTER
04500		ILDB C,T	;GET COMMAND CHR.
04600		SKIPN D,CMTAB(C);GET CAMMAND ADDRS
04700		JRST SERR	;NONE, STRING ERROR
04800		JRST (D)	;GO TO COMMAND ROUTINE
04900	EXWRD:	MOVE C,(T)	;GET EXTRA WORD
05000		MOVEM C,EWDSAV#
05100		JRST MR1
05200	;]]]]]]]]]]  HERE FOR ]:
05300	ZIGL:	SKIPA C,[0]	;ZIG LEFT BITS IN FIRST WORD
05400	;[[[[[[[[[[[  HERE FOR [:
05500	ZIGR:	MOVEI C,1	;ZIG RIGHT BITS IN SECOND WORD
05600		PUSH P,C	;SAVE
05700		PUSHJ P,ARGS	;GET ARGS
05800		MOVE D,A2	;GET DIP ROW
05900		DPB A1,[POINT 5,D,30];GET DIP COL.
06000		HRRZ E,TYPPNT(D);GET TABLE POINTER
06100		ADD E,(P)	;POINT TO CORRECT WORD
06200		MOVEI F,1
06300		LSH F,(A3)	;GET BIT FOR PIN
06400		ORM F,(E)	;TURN IT ON
06500		POP P,E
06600		RET
06700	
06800	;↑↑↑↑↑↑↑↑↑↑   HERE FOR ↑:
06900	CUA:	PUSHJ P,ARGS	;GET ARGS IN A1 TO A6
07000		LDB C,[POINT 7,A2,35];GET PIN COL.
07100		DPB A1,[POINT 5,C,28];PUT IN DIP COL.
07200		ADDI C,VLIST	;MAKE POINTER TO TABLE
07300		PUSHJ P,ISOK	;IS THIS WIRE OK?
07400		MOVSS NPSAV	;NO, GET LOSE ADDRS IN LEFT
07500		RET
07600	;←←←←←←←←← HERE FOR ←
07700	CLA:	PUSHJ P,ARGS	;GET ARGS IN A1 TO A6
07800		LDB C,[POINT 7,A2,35];GET PIN ROW
07900		DPB A1,[POINT 5,C,28];PUT IN DIP ROW
08000		ADDI C,HLIST	;MAKE POINTER TO TABLE
08100		PUSHJ P,ISOK	;IS LINE OK?
08200		MOVSS NPSAV	;NO, PUT LOSE ADDRS IN LEFT
08300		RET
08400	;UUUUUUUUUU  HERE FOR U
08500	CMU:	PUSHJ P,ARGS	;GET ARGS IN A1 TO A6
08600		RET
08700	;MMMMMMM HERE FOR M
08800	CM:	ILDB C,T	;GET NEXT CHR. (↑ OR ←)
08900		MOVEI D,
09000		CAIN C,"↑"	;IS IT ↑?
09100		MOVEI D,VLIST	;YES, VERT WIRE
09200		CAIN C,"←"	;IS IT ←?
09300		MOVEI D,HLIST	;YES, HORIZ. WIRE
09400		JUMPE D,SERR	;NEITHER?
09500		MOVEM D,CMSAV1#	;SAVE POINTER
09600		DOBLT (E)
09700		MOVEI C,	;PUT ARGS IN A1
09800		PUSHJ P,ARG1	;GET 1 ARG
09900		PUSH P,A1	;SAVE FIRST FLAGS
10000		PUSHJ P,ARG1	;GET 1 ARG
10100		PUSH P,A1	;SAVE SECOND FLAGS
10200		MOVE A1,A1S	;RESTORE A1
10300		PUSHJ P,ARGS	;GET REST OF ARGS
10400	CXM:	FORM1(A1,A2,C)	;GET LIST POINTR
10500		ADD C,CMSAV1	;ADD START OF TABLE
10600		FORM2(A3,A4,D)	;MAKE UP CORRECT FORMAT ENTRIES
10700		FORM2(A5,A6,E)	;...
10800		SETZM SWPFLG#
10900		CAML D,E	;GET SMALLER IN D
11000		SETOM SWPFLG
11100		POP P,F		;GET SECOND FLAGS
11200		DPB F,[POINT 4,E,21];OR IN FLAGS
11300		POP P,F		;GET FIRST FLAGS
11400		DPB F,[POINT 4,D,21];OR IN FLAGS
11500		SKIPE SWPFLG	;D AND E IN WRONG ORDER?
11600		EXCH D,E	;YES, SWAP
11700	CMDCON:	HRL E,D		;PUT SMALLER IN LEFT OF LARGER
11800		TDZ E,[200,,200]
11900		MOVEI F,2	;2 WORD FREE STRG.
12000		PUSHJ P,GETFST	;GET 2 WORD BLOCK
12100		HRRZ D,(C)	;LINK IN
12200		HRRM F,(C)	;...
12300		MOVEM D,(F)	;...
12400		MOVEM E,1(F)	;DEPOSIT ENTRY
12500		RET
12600	CMFAIL:	MOVE P,CMPSAV
12700		POPJ P,
12800	CMDONE:	MOVE P,CMPSAV	;RESTORE STACK
12900		AOS (P)
13000		POPJ P,
13100	;PPPPPPP HERE FOR P
13200	CMP:	ILDB D,T	;GET O OR U
13300		CAIN D,"U"	;PUSH?
13400		JRST CITPU	;YES
13500		CAIE D,"O"	;POP?
13600		JRST SERR	;NO, ERROR
13700		HRLI E,-5(P)	;MAKE BLT WORD
13800		HRRI E,A1	;..
13900		BLT E,A6	;POP ARGS
14000		SUB P,[6,,6]
14100		RET
14200	CITPU:	HRLI E,A1	;MAKE BLT POINTER
14300		HRRI E,1(P)
14400		ADD P,[6,,6]
14500		SKIPL P
14600		JRST [HRLI P,-1
14700			PUSH P,P;PDL OV
14800			JRST 4,.]
14900		BLT E,(P)	;PUSH ARGS
15000		RET
15100	;DDDDDDDD  HERE FOR D
15200	CMD:	PUSHJ P,ARGS	;GET 6 ARGS, BUT THEY ARE FUNNY, SO
15300				;RESTORE OLD ARGS WHEN DONE
15400	CXD:	DPB A2,[POINT 5,A3,30];FORM DIP LOC
15500		MOVE D,TYPPNT(A3);GET TABLE
15600		ADDI D,3(A4)	;ADD PIN #, GET TO ENTRY
15700		MOVE E,(D)	;GET OLD ENTRY
15800		FORM2(A5,A6,F)	;GET NEW ENTRY
15900		JUMPGE A1,.+2	;UP OR DOWN?
16000		MOVSS E		;UP, GET ENTRY IN RIGHT
16100		TRNE E,-1	;IS THERE AN OLD ENTRY ALREADY?
16200		JRST CDOLD	;YES
16300		MOVM A5,A1	;GET FLAGS
16400		HRR E,F		;GET NEW ENTRY
16500		DPB A5,[POINT 4,E,21];PUT IN FLAGS
16600		JUMPGE A1,.+2	;UP OR DOWN?
16700		MOVSS E		;UP, PUT NEW ENTRY IN LEFT
16800		MOVEM E,(D)	;DEPOSIT
16900		MOVE F,[A1S,,A1]
17000		BLT F,A6	;RESTORE ARGS
17100		RET
17200	CDOLD:	PUSH P,E	;SAVE ENTRY
17300		SETUP (F)	;STANDARDIZE NEW ENTRY FOR COMP
17400		SETUP (E)	;STAND. OLD ENTRY
17500		CAML E,F	;OLD LARGER THAN NEW?
17600		JUMPL A1,CDLV	;OLD LARGER, LEAVE THER IF GOING UP
17700		CAMG E,F	;...
17800		JUMPGE A1,CDLV	;OLD SMALLER, LEAVE THER IF GOING DOWN
17900		JUMPGE A1,.+3	;UP OR DOWN?
18000		HRLM F,(D)	;UP, DWPOSIT NEW
18100		SKIPA
18200		HRRM F,(D)	;DOWN, DEPOSIT NEW
18300	CDLV:	MOVMS A1	;GET FLAGS
18400		CAML E,F	;GET CORRECT SMALLER IN D, LARGER IN E
18500		JRST .+5
18600		POP P,D		;OLD (SMALLER) IN D
18700		MOVE E,F	;NEW IN E
18800		DPB A1,[POINT 4,E,21];PUT IN FLAGS
18900		JRST .+4
19000		POP P,E		;OLD (LARGER) IN E
19100		MOVE D,F	;NEW IN D
19200		DPB A1,[POINT 4,D,21];PUT IN FLAGS
19300		LDB C,[POINT 7,A4,35];GET DIP PIN COL.
19400		DPB A2,[POINT 5,C,28];PUT IN DIP COL.
19500		MOVE F,[A1S,,A1]
19600		BLT F,A6	;RESTORE ARGS
19700		ADDI C,VLIST	;POINTER TO TABLE
19800		JRST CMDCON	;MARK ENTRY
19900	
20000	ARGS:	MOVEI C,	;FIRST ARG IN A1
20100		DOBLT(D)	;SAVE ARGS
20200		PUSHJ P,ARG1	;GET 1 ARG
20300		CAIE C,5	;HAVE WE DONE 6?
20400		AOJA C,.-2	;NO, DO MORE
20500		POPJ P,
20600	;TTTTTTTT  HERE FOR T
20700	CMT:	DOBLT (D)	;SAVE ARGS
20800		MOVEI C,	;ARGS IN C
20900		PUSHJ P,ARG1	;GET FIRST ARG
21000		PUSH P,A1	;HOLD
21100		PUSHJ P,ARG1	;GET SECOND ARG
21200		POP P,E
21300		CAME A1,E	;ARGS EQUAL?
21400		MOVSS NPSAV	;NO, GET FAIL ADDRS IN LEFT
21500		MOVE A1,A1S	;RESTORE A1
21600		RET
21700	CMEVEN:	DOBLT (D)
21800		MOVEI C,
21900		PUSHJ P,ARG1
22000		MOVE E,A1
22100		MOVE A1,A1S
22200		TRNE E,1
22300		MOVSS NPSAV
22400		RET
22500	
22600	
22700	;CCCCCCCCCCC HERE FOR C (CALL)
22800	CMCALL:	ILDB C,T
22900		CAIN C,"O"	;IS NEXT CHR O?
23000		JRST CMC1	;YES, ORDINARY CALL
23100		CAIE C,"R"	;NO, IS IT R?
23200		JRST SERR	;NO, ERROR
23300		ILDB E,T	;YES, GET NEXT
23400		MOVE C,CALPNT
23500		POP C,D		;GET RETURN ADDRS
23600		PUSH C,NPSAV	;SAVE NEW ONE
23700		MOVEM D,NPSAV	;STORE IT
23800		CAIN E,"S"	;SUCCESS?
23900		JRST .+4	;YES
24000		CAIE E,"F"	;FAILURE?
24100		JRST SERR
24200		MOVSS NPSAV
24300		PUSHJ P,ARGS
24400		RET
24500	CMC1:	PUSHJ P,ARGS
24600		MOVE C,CALPNT#	;GET CALL STACK POINTER
24700		PUSH C,NPSAV	;SAVE RETURN ADDRS
24800		MOVEM C,CALPNT
24900		SKIPA T,EWDSAV
25000		RET
25100	;RRRRRRRR HERE FOR R
25200	CMRET:	PUSHJ P,ARGS	;GET ARGS
25300		MOVE C,CALPNT
25400		POP C,NPSAV	;GET RETURN ADDRS
25500		MOVEM C,CALPNT
25600		MOVSS NPSAV
25700		RET
25800	;¬¬¬¬¬¬¬¬¬¬  HERE FOR ¬
25900	CMPOP:	MOVE C,CALPNT
26000		POP C,D		;THROW OUT TOP ADDRS ON STACK
26100		MOVEM C,CALPNT
26200		RET
26300	
26400	;SSSSSSSSSS HERE FOR S
26500	CMSTO:	ILDB C,T	;GET "PLACE"
26600		CAIN C,"P"
26700		JRST CMSP
26800		MOVEI D,
26900		CAIN C,"*"
27000		MOVEI D,STAR
27100		CAIN C,"$"
27200		MOVEI D,DOLR
27300		CAIN C,"%"
27400		MOVEI D,PERC
27500		CAIN C,"α"
27600		MOVEI D,ALPH
27700		JUMPE D,SERR
27800		MOVEM D,CMSAV1	;SAVE TABLE POINTER
27900		PUSHJ P,ARGS	;GET ARGS
28000		MOVE D,CMSAV1	;GET TABLE POINTER
28100		MOVEI E,5(D)
28200		HRLI D,A1
28300		BLT D,(E)	;STORE ARGS
28400		RET
28500	CMSP:	DOBLT (E)
28600		MOVEI C,
28700		PUSHJ P,ARG1
28800		MOVEM A1,PPPP
28900		MOVE A1,A1S
29000		RET
29100	;FFFFFFFFFFF HERE FOR F
29200	CMFIND:	PUSHJ P,ARGS	;GET ARGS (RESTORE AT END)
29300		DPB A2,[POINT 5,A3,30];FORM DIP LOC.
29400		MOVE D,TYPPNT(A3)	;GET TABLE
29500		ADDI D,3(A4)	;ADD PIN #
29600		MOVE E,(D)	;GET ENTRY
29700		JUMPGE A1,.+2	;UP OR DOWN?
29800		MOVSS E		;UP
29900		TRNN E,-1	;ANY ENTRY?
30000		JRST CMFFL	;NO, FAIL
30100		MOVE C,E
30200		ANDI C,177
30300		CAIE C,100	;IS IT INFINITY?
30400		CAIN C,77	;...
30500		JRST CMFFL	;YES, FAIL
30600		MOVEM C,STAR+1	;DEPOSIT FINE ROW
30700		ANDI E,37000
30800		LSH E,-2
30900		OR C,E
31000		LSH E,-7
31100		MOVEM E,STAR	;DEPOSIT DIP ROW
31200		ADDI C,HLIST	;MAKE TABLE POINTER
31300		MOVE A3,A2	;GET DIP COL.
31400		MOVE A6,A4	;MAKE A 0 LENGTH SEGMENT
31500		MOVE A5,A3	;.. AT THIS PLACE
31600		PUSHJ P,ISOK	;FIND THE WIRE
31700		SKIPA
31800		JRST 4,.	;COULDN'T FIND?
31900		MOVE D,1(C)	;GET ENDPINTS
32000		DEFINE FOO (A1,A3,A4)
32100	{	LDB E,[POINT A1,D,A3]
32200		MOVEM E,STAR+A4}
32300		FOO (7,35,3);STORE THEM
32400		FOO (5,26,2)
32500		FOO (7,17,5)
32600		FOO (5,8,4)
32700		SKIPA
32800	CMFFL:	MOVSS NPSAV
32900		MOVE F,[A1S,,A1]
33000		BLT F,A6
33100		RET
33200	CMBRK:	JRST 4,.
33300	;≡≡≡≡≡≡≡≡≡≡≡≡≡ HERE FOR ≡
33400	CMCLOS:	PUSHJ P,ARGS	;GET ARGS
33500		FORM2(A1,A2,D)
33600		FORM2(A3,A4,E)
33700		FORM2(A5,A6,F)
33800		MOVE C,D
33900		SUB C,E
34000		MOVMM C,CMSAV1
34100		MOVE C,D
34200		SUB C,F
34300		MOVMS C
34400		MOVEM A5,STAR+4
34500		MOVEM A6,STAR+5
34600		CAMG C,CMSAV1
34700		JRST .+3
34800		MOVEM A3,STAR+4
34900		MOVEM A4,STAR+5
35000		CAML E,F
35100		EXCH E,F
35200		CAML D,E
35300		CAMLE D,F
35400		SKIPA
35500		MOVSS NPSAV
35600		RET
35700	CMDIN:	ILDB C,T	;GET NEXT CHR.
35800		CAIN C,"M"	;IS IT M?
35900		JRST CDIM	;YES
36000		CAIE C,"D"	;IS IT D?
36100		JRST SERR	;NO
36200		MOVE D,PPPP
36300		SETZM IPDL(D)	;FLAG FOR D
36400	CMIC:	PUSHJ P,ARGS	;GET ARGS
36500		MOVE D,PPPP	;GET POINTER
36600		HRLI D,A1
36700		ADDI D,IPDL+1
36800		MOVEI E,5(D)
36900		BLT D,(E)	;SAVE ARGS
37000		MOVEI E,7
37100		ADDM E,PPPP	;INCR. POINTER
37200		MOVE D,[A1S,,A1]
37300		BLT D,A6
37400		RET
37500	CDIM:	ILDB C,T
37600		MOVEI D,
37700		CAIN C,"↑"
37800		MOVEI D,VLIST
37900		CAIN C,"←"
38000		MOVEI D,HLIST
38100		JUMPE D,SERR
38200		MOVEM D,CMSAV1
38300		DOBLT (E)
38400		MOVEI C,
38500		PUSHJ P,ARG1
38600		PUSH P,A1
38700		PUSHJ P,ARG1
38800		POP P,E
38900		DPB E,[POINT 9,A1,26]
39000		HRL A1,CMSAV1
39100		MOVE F,PPPP
39200		MOVEM A1,IPDL(F)
39300		MOVE A1,A1S
39400		JRST CMIC
39500	
39600	;XXXXXXXXXXXXXXXXX
39700	CMXCT:	SKIPG D,PPPP
39800		JRST CMXRET
39900		DOBLT (F)
40000		HRLI E,IPDL-6(D)
40100		HRRI E,A1
40200		BLT E,A6
40300		MOVNI F,7
40400		ADDM F,PPPP
40500		SUBI T,1
40600		HRLM T,NPSAV
40700		SKIPN E,IPDL-7(D)
40800		JRST CXD
40900		LDB F,[POINT 9,E,26]
41000		PUSH P,F
41100		PUSH P,E
41200		HLRZM E,CMSAV1
41300		JRST CXM
41400	CMDAST:	ILDB C,T
41500		MOVEI D,
41600		CAIN C,"*"
41700		MOVEI D,STAR
41800		CAIN C,"%"
41900		MOVEI D,PERC
42000		CAIN C,"$"
42100		MOVEI D,DOLR
42200		CAIN C,"α"
42300		MOVEI D,ALPH
42400		JUMPE D,SERR
42500		ILDB C,T
42600		CAILE C,60
42700		CAIL C,67
42800		JRST SERR
42900		ADDI D,-61(C)
43000		PUSH P,D
43100		MOVEI C,
43200		DOBLT (E)
43300		PUSHJ P,ARG1
43400		POP P,D
43500		MOVEM A1,(D)
43600		MOVE A1,A1S
43700	CMXRET:	RET
43800	
43900	ISOK:	HRRZ C,(C)	;GET FIRST ENTRY
44000		JUMPE C,CPOPJ1	;NONE, WE WIN
44100		FORM2(A3,A4,D)	;GET STANDARDIZED FIRST ENTPOINT
44200		FORM2(A5,A6,E)	;GET SECOND
44300		CAML D,E	;GET SMALLER IN D
44400		EXCH D,E
44500	ISL1:	HLRZ F,1(C)	;GET SMALLER OLD ONE
44600		SETUP(F)	;STANDARDIZE
44700		CAML D,F	;SMALLER NEW ONE LESS THAN SAMLLER OLD?
44800		JRST TGJ	;NO, MORE TESTS NEEDED
44900		CAML E,F	;YES, LARGER NEW ONE LESS THAN SAMLLER OLD?
45000		POPJ P,		;NO, WE LOSE
45100		SUB F,E		;IS DIF. ONLY 1?
45200		CAILE F,1	;IS DIF. ONLY 1?
45300		JRST IOK	;NO, WE WIN, TRY NEXT
45400		POPJ P,		;YES, LOSE
45500	TGJ:	HRRZ F,1(C)	;GET LARGER OLD ONE
45600		SETUP (F)
45700		CAMG D,F	;IS SMALLER NEW ONE GREATER THAN LARGER OLD?
45800		POPJ P,		;NO, LOSE
45900		SUBM D,F
46000		CAIG F,1	;IS DIF ONLY 1?
46100		POPJ P,		;YES, LOSE
46200	IOK:	HRRZ C,(C)	;GET NEXT LIST ENTRY
46300		JUMPN C,ISL1	;LOOP IF NOT DONE
46400	↑CPOPJ1:AOS (P)
46500		POPJ P,		;DONE, WIN
46600	
46700	ARG1:	SETZM SINFLG#	;CLEAR SIGN FLAG
46800		ILDB D,T	;GET CHR.
46900		JRST @AGTAB(D)	;GO TO CORRECT PLACE
47000	ATAB:	ILDB D,T	;GT TABLE#
47100		SUBI D,60
47200		JUMPL D,SERR	;IN RANGE?
47300		PUSH P,ATTAB(D)	;SAVE POINTER TO TABLE
47400		PUSHJ P,ARG1	;GET REST OF ARG.
47500		POP P,F		;GET TABLE
47600		ADD F,1(C)	;ADD REST OF ARG.
47700		MOVE F,(F)	;GET TABLE ENTRY
47800		MOVEM F,1(C)	;DEPOSIT
47900		POPJ P,
48000	ASIZ:	ILDB D,T	;GET S OR D
48100		MOVEI F,
48200		CAIN D,"S"	;IS IT S?
48300		HLRZ F,SS	;YES, GET SOURCE DIP #
48400		CAIN D,"D"	;IS IT D?
48500		HLRZ F,DD	;YES, GET DEST DIP #
48600		JUMPE F,SERR	;NEITHER?
48700		HRRZ D,TYPTYP(F);GET DIP TYPE
48800		HLRZ F,TYPTBN(D);GET SIZE #
48900		MOVEM F,1(C)	;DEPOSIT
49000		POPJ P,
49100	ARDST:	SKIPA E,DD	;** D **  GET DEST INFO
49200	ARSRC:	MOVE E,SS	;** S **  GET SOURCE INFO
49300		ILDB D,T	;GET P OR D
49400		CAIN D,"D"	;IS IT DIP?
49500		JRST AITDIP	;YES
49600		CAIE D,"P"	;IS IT PIN?
49700		JRST SERR	;NO
49800		ILDB D,T	;GET R OR C
49900		CAIN D,"C"	;IS IT C?
50000		JRST AITCOL	;YES
50100		CAIE D,"R"	;IS IT R?
50200		JRST SERR	;NO
50300		HLRZ F,E
50400		HRRZ F,TYPTYP(F);GET TYPE OF DIP
50500		HLRZ F,TYPTBN(F);GET SIZE #
50600		MOVE F,TTAB1(F)	;GET ROW FOR EVEN PIN
50700		TRNE E,1	;ODD PIN?
50800		MOVNS F		;YES, GET FOR ODD PIN
50900		JRST ARGPRO
51000	AITCOL:	HRRZ F,E	;GET PIN #
51100		TRNE F,100
51200		OR F,[XWD -1,777700]
51300		JRST ARGPRO
51400	AITDIP:	ILDB D,T	;GET R OR C
51500		CAIN D,"C"	;IS IT C?
51600		JRST AITC	;YES
51700		CAIE D,"R"	; IS IT R?
51800		JRST SERR	;NO
51900		LDB F,[POINT 5,E,17];GET ROW
52000		JRST ARGPRO
52100	AITC:	LDB F,[POINT 5,E,12];GET COL.
52200	ARGPRO:	MOVEM F,1(C)	;DEPOSIT ARG
52300	CPOPJ:	POPJ P,
52400	ADIG:	MOVEI F,-60(D)	;GET FIRST DIGIT
52500	DIGLOP:	ILDB D,T	;GET NEXT DIGIT
52600		CAIN D,","	;IS IT ,?
52700		JRST DIGDON	;YES, DIGIT DONE
52800		CAIL D,60	;IS IT A DIGIT?
52900		CAIL D,72	;...
53000		JRST SERR	;NO, ERROR
53100		IMULI F,12	;MULT WHAT WE HAVE
53200		ADDI F,-60(D)	;ADD IN NEW DIGIT
53300		JRST DIGLOP
53400	DIGDON:	SKIPGE SINFLG	;IS SIGN NEG?
53500		MOVNS F		;YES
53600		MOVEM F,1(C)	;DEPOSIT ARG
53700		POPJ P,
53800	ARINF:	MOVEI F,77	;** ∞ **  GET + INF.
53900		SKIPGE SINFLG	;NEG SIGN?
54000		HRROI F,777700	;YES, GET - INF.
54100		MOVEM F,1(C)	;DEPOSIT
54200		POPJ P,
54300	ARBWAR:	ILDB D,T	;** ↔ ;** GET NEXT CHR (C OR R)
54400		CAIN D,"C"	;IS IT COL?
54500		JRST BITCOL	;YES
54600		CAIE D,"R"	;IS IT ROW?
54700		JRST SERR	;NO, ERROR
54800		LDB F,[POINT 5,DD,17];GET DEST DIP COL.
54900		LDB E,[POINT 5,SS,17];GET SRC. DIP COL.
55000		SUB F,E		;GET DIFF.
55100		JUMPN F,ABA1	;ZERO?
55200		TRNE SS,1	;YES, DO PIN DIF. SOURCE EVEN?
55300		JRST ARG1+1	;NO, MUST BE + OR 0
55400		TRNE DD,1	;YES, IS DEST EVEN?
55500		SKIPA		;NO, -
55600	ABA1:	JUMPGE F,ARG1+1	;PLUS, NO CHANGE
55700	ARMINS:	SETCMM SINFLG	;** - **  MINUS, REVERSE SIGN ; ** - **
55800		JRST ARG1+1	;PROCEED
55900	BITCOL:	LDB F,[POINT 5,DD,12];GET DEST ROW
56000		LDB E,[POINT 5,SS,12];GET SRC. ROW
56100		SUB F,E		;GET DIF.
56200		JUMPN F,ABA1	;ZERO?
56300		HRRZ F,DD	;YES, DO PINS
56400		SUBI F,(SS)	;SUB SOURCE PIN
56500		JUMPGE F,ARG1+1	;+, PROCEED
56600		SETCMM SINFLG	;-, REVERSE SIGN
56700		JRST ARG1+1
56800	AINC:	PUSHJ P,ARG1	;** I **  GET REST OF ARG
56900		MOVE F,A1S(C)	;GET FORMER ARG
57000		ADDM F,1(C)	;ADD TO INCREMENT
57100		POPJ P,
57200	AARG:	ILDB D,T	;GET CHR.
57300		CAIL D,61	;MUST BE 1 TO 6
57400		CAIL D,67	;...
57500		JRST SERR	;NO
57600		MOVE F,A1S-61(D);GET OLD ARG
57700		JRST DIGDON	;DEPOSIT
57800	ARGALF:	MOVEI E,ALPH	;ααααααααααααααααααααααααααααααααααα
57900		JRST .+6
58000	ARGSTA:	MOVEI E,STAR	;***********
58100		JRST .+4
58200	ARGDOL:	MOVEI E,DOLR	;$$$$$$$$$$
58300		JRST .+2
58400	ARGPER:	MOVEI E,PERC	;%%%%%%%%%%
58500		ILDB D,T
58600		CAIL D,61
58700		CAIL D,67
58800		JRST SERR
58900		ADDI E,-61(D)
59000		MOVE F,(E)
59100		JRST DIGDON
59200	ARGSIN:	PUSH P,SINFLG
59300		PUSHJ P,ARG1
59400		POP P,SINFLG
59500		SKIPGE 1(C)
59600		SETCMM SINFLG
59700		JRST ARG1+1
59800	ARGP:	MOVE F,PPPP
59900		JRST DIGDON
60000	
60100	
60200	BEND
60300	END STRT